I found a pet script on YouTube that shows you how to make a pet that follows the player. It works, but you have to change the pet's part's parent to the player. I made a script so that when you touch a part, it would clone the pet and parent it. It works, but my pet is moving to a different place. So I copied the position of a part where I want the pet to go and put it in my script. But it still goes elsewhere. Here is the script for the cloning, that isn't working:
function tch(h)
local original = script.Parent.Parent.Pet
local copy = original:Clone()
copy.Transparency = 0
copy.Parent = h.Parent.Parent
copy:SetPrimaryPartCFrame(CFrame.new(-60.502, 5.507, 39.622)) -- doesn't move here???
end
script.Parent.Touched:connect(tch)
Also here is the LocalScript inside the pet's part:
local char = script.Parent.Parent
local hum = char:FindFirstChild("Humanoid")
local torso = char:FindFirstChild("Torso")
local pet = script.Parent
local maxFloat = 1
local floatInc = 0.025
local sw = false
local fl = 0
while true do
wait()
if not sw then
fl = fl + floatInc
if fl >= maxFloat then
sw = true
end
else
fl = fl - floatInc
if fl <=-maxFloat then
sw = false
end
end
if pet ~= nil and hum ~= nil and torso ~= nil then
if hum.Health >= 0 then
local cf = torso.CFrame * CFrame.new(3,2+fl,3)
pet.BodyPosition.Position = Vector3.new(cf.x,cf.y,cf.z)
pet.BodyGyro.CFrame = torso.CFrame * CFrame.new(3,0,-3)
else
break
end
end
end
It keeps appearing at -0.011, -0.208, 0.006 by the way

3 comments
Can you go to the pet model and then search for "primary part" and tell me what is the primary part?
Search where? In the Workspace?
no is the pet a "model"? if yes click on the model and tell me what is the primary part of the model