我已经尝试从Vector3切换到CFrame,但仍然无法正常工作。我得到的最好的结果是,空中出现了十项壮举,这是我到目前为止所拥有的。
local Dog = game:GetService("ReplicatedStorage"):WaitForChild("PetTesting")
local RunService = game:GetService("RunService")
local tweenService = game:GetService("TweenService")
local Petfollow = game:GetService("ReplicatedStorage"):WaitForChild("PetFollow")
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(char)
wait(1)
local dc = Dog:Clone()
dc.Name = "Pet"
dc.Parent = char
local offsetCframe = CFrame.new(0, 0, 0)
dc.CFrame = char:WaitForChild("HumanoidRootPart").CFrame + offsetCframe
dc.Anchored = true
dc.CanCollide = false
dc.Transparency = 0
end)
end)
您可以按https://developer.roblox.com/en-us/api-reference/datatype/CFrame中所述使用一些CFrame操作。我不确定这是否是正确的方法,因此如果不正确,请回复。
local offset = Vector3.new(0, 0, 10)
local newCFrame = humanoidRootPart.CFrame * offset