EDIT: I made the map semi-transparent so i can see the pet, it just falls forever
I'm trying to understand how pets work in the game, so I've done a bit of experimenting, and this is what I have:
local newPet = script.Parent
newPet.CanCollide = false
newPet.Anchored = false
local petPos = Instance.new("BodyPosition", newPet)
local petGyro = Instance.new("BodyGyro", newPet)
petGyro.MaxTorque = Vector3.new(900000,900000,900000)
local owner = newPet.ID.Value
local followPosition = Vector3.new(2,2,0)
while wait(1) do
local ownerObj = workspace:WaitForChild(owner)
local player = game.Players:FindFirstChild(ownerObj.Name)
local ownerPos = ownerObj.HumanoidRootPart.Position
local stopAt = ((ownerPos - newPet.Position).magnitude - 1) * 1000
petPos.P = stopAt
petPos.Position = ownerPos + followPosition
petGyro.CFrame = ownerObj.HumanoidRootPart.CFrame
end
the pet is for just me, and i have a string value of my username in the pet, when I join the pet just disappears. I've changed the pet, and it still disappears, no error messages. Please help me, I'm brand new to coding.

3 comments
the pet is supposed to go behind me lol
i got this error in the output after i put in the script u told me to
Workspace.fieryPet.Script:4: attempt to concatenate string with Vector3