As a person who has no knowledge about vectors or cframes, I have no idea what to change. I tried adding a wait after the wing line of code but nothing changed, please help.
local pet = script.Parent
pet.CanCollide = false
local petposition = Instance.new("BodyPosition", pet)
local petgyro = Instance.new("BodyGyro", pet)
petgyro.MaxTorque = Vector3.new(400000, 400000, 400000)
local owner = 'altornativee'
while(1) do
wait()
local owner = workspace:WaitForChild(owner)
local ownerpos = owner.HumanoidRootPart.Position
local wing = ((ownerpos - pet.Position).Magnitude - 5) * 1000
petposition.P = wing
petposition = ownerpos + Vector3.new(0, 10, 0)
petgyro.CFrame = owner.HumanoidRootPart.CFrame
end
The variable petposition holds a reference to the BodyPositioninstance. Position is one of the properties of the BodyPosition instance and therefore you do .Position to access it.