I am trying to make a system where a pet will follow you even if it is a model. My current problem is the system I have now only works on one part or union. Any help would be great!
local Workspace = game:GetService("Workspace")
local pet = script.Parent:GetChildren()
local localplayer = game.Players.PlayerAdded
local pet = script.Parent
function givePet (player)
if player then
local character = player.Character
if character then
local humRootPart = character.HumanoidRootPart
local newPet = pet:Clone ()
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 wait() do
bodyPos.Position = humRootPart.Position + Vector3.new(2, 2, 3)
bodyGyro.CFrame = humRootPart.CFrame
end
end
end
end
localplayer:Connect(function(player)
player.CharacterAdded:Connect(function(char)
givePet(player)
end)
end)