Pet's body will follow me, but nothing else

My pet’s body will follow me, but nothing else. I’ve tried weld constraints, but they don’t work.
Pet (Model) > Lot’s of mesh parts and PrimaryPart
Is there a way to make the entire pet move instead of scripting all of their body parts to move?

local Players = game:GetService("Players")

local function makePetFollowPlayer(pet, player)
	local humanoidRootPart = player.Character:WaitForChild("HumanoidRootPart")

	while true do
		pet.PrimaryPart.CFrame = pet.PrimaryPart.CFrame:Lerp(humanoidRootPart.CFrame * CFrame.new(0, 3, 3), 0.1)
		wait()
	end
end

Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(character)
		wait(2) -- Wait for the character to load

		local pet = game.ServerStorage.Pet:Clone()
		pet.Parent = game.Workspace

		makePetFollowPlayer(pet, player)
	end)
end)

1 Like

Models do have a :PivotTo() method which moves the entire model to given CFrame

1 Like

You could use PivotTo, as the person above me suggested, or if that doesn’t work you could unanchor the other parts of the pet and weld them to the primary part. (Weld constraints or normal welds with a weld calculator would work)

2 Likes

Like this?

local Players = game:GetService("Players")

local function makePetFollowPlayer(pet, player)
	local humanoidRootPart = player.Character:WaitForChild("HumanoidRootPart")

	while true do
		pet.PrimaryPart:PivotTo(humanoidRootPart.CFrame * CFrame.new(0, 3, 3), 0.1)
		wait()
	end
end

Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(character)
		wait(2) -- Wait for the character to load

		local pet = game.ServerStorage.Pet:Clone()
		pet.Parent = game.Workspace

		makePetFollowPlayer(pet, player)
	end)
end)
1 Like

Replace pet.PrimaryPart with just pet

2 Likes

Legend, Thanks! //////////////////

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.