Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

I Cant Get My Pet Script Working And I Have No Idea Why?

Asked by 4 years ago

Hi, I can't Figure out what's wrong with my code. any help would be great!

local NewPet = script.Parent

NewPet.CanCollide = false

local PetPos = Instance.new("BodyPosition", NewPet)
local PetGyro = Instance.new("BodyGyro", NewPet)
PetGyro.MaxTorque = Vector3.new(400000,400000,400000)
local Owner = 'Pigred72'

while (1) do
    wait()
    local OwnerObj = workspace:WaitForChild(Owner)
    local OwnerPos = OwnerObj.HumanoidRootPart.Position
    local StopAt = ((OwnerObj - NewPet.Position).magnitude - 5) * 1000
    PetPos.P = StopAt
    PetPos.Position = OwnerPos + Vector3.new(0,10,0)
    PetGyro.CFrame = OwnerObj.HumanoidRootPart.CFrame
end
0
What exactly is going wrong? rabbi99 714 — 4y
0
The pet just lies on the ground Pigred72 0 — 4y

Answer this question