So I am trying to make a pet follow script but whenever I add a pet it just falls. Here is my code (This is in a server script)
local function givePet(player, pet)
if player then
local character = player.Character
if character then
local humRootPart = character.HumanoidRootPart
local newPet = pet:Clone()
newPet:SetPrimaryPartCFrame(humRootPart.CFrame)
newPet.Parent = character
local bodyPos = Instance.new("BodyPosition", newPet)
bodyPos.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
local bodyGyro = Instance.new("BodyGyro", newPet)
bodyGyro.MaxTorque = Vector3.new(math.huge, math.huge, math.huge)
while true do
bodyPos.Position = humRootPart.Position + Vector3.new(2, 2, 3)
bodyGyro.CFrame = humRootPart.CFrame
wait()
end
end
end
end
And here is a video of what happens each time I give myself a pet
https://gyazo.com/ba8b100299b8473bff77fb3dad1d1856
As you can see the pet just falls as if no forces are applied to it. All the parts of the pet are unanchored and can collide is turned off. I’ve tried making all the parts massless but I get the same result. I have paused the game and it does create the body position and body gyro with the correct values so I have no idea what is going on here. I’ve even tried changing the math.huge() to some large numbers but that didn’t change anything. What am I doing wrong here?