Hey there, so I have this pet movement script but for some reason it started becoming really glitchy (video below), I haven’t touched the code and it randomly started doing this.
Video
Code
local bodyPos = Instance.new("BodyPosition")
bodyPos.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
local bodyGyro = Instance.new("BodyGyro")
bodyGyro.MaxTorque = Vector3.new(math.huge, 8000, math.huge)
bodyGyro.Parent = newPet.PrimaryPart
bodyPos.Parent = newPet.PrimaryPart
task.spawn(function()
while task.wait() do
if newPet then
local newCFrame = humRootPart.CFrame * CFrame.new(-3, 1.25 + math.sin(tick()) * 0.25, 3)
bodyPos.Position = Vector3.new(newCFrame.X, newCFrame.Y, newCFrame.Z)
bodyGyro.CFrame = recipCharacter.Head.CFrame * CFrame.new(3, 0, -3)
else
break
end
end
end)
Error:
Any help is very much appreciated, thank you sm in advance!