I want the pet to follow the player but when the player equips the pet it just spawns at one position and never changes.
LocalScript inside pet
local head = script.Parent.Parent.Parent:FindFirstChild("Head")
local pet = script.Parent
while true do
wait()
local p = head.CFrame * Vector3.new(2,1,2.2)
pet.BodyGyro.CFrame = head.CFrame
print("p.x: ",p.x,"\np.y",p.y,"\np.z",p.z)
pet.BodyPosition.Position = Vector3.new(p.x,p.y,p.z)
end
ServerScript
petEquip = game:GetService("ReplicatedStorage"):WaitForChild("PetEquip")
petData = require(game:GetService("ServerScriptService"):WaitForChild("PetData"))
petEquip.OnServerEvent:Connect(function(player)
local pet = game.ReplicatedStorage:FindFirstChild("Pets").Pet:Clone()
local FindPet = player.Character.PetContainer:FindFirstChild("Pet")
if not FindPet then
pet.Parent = workspace:FindFirstChild(player.Name).PetContainer
pet.LocalScript.Disabled = false
player.Values.Mult.Value = player.Values.Mult.Value + petData.AdminPet["mult"]
player.Values.Speed.Value = player.Values.Speed.Value + petData.AdminPet["speed"]
end
end)
