#why this code won't work?

26 messages · Page 1 of 1 (latest)

round burrow
#

i tried to change it but it still won't work

#
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 = "Evanove68"
 
while(1) do
    task.wait()
    local OwnerObj = workspace:WaitForChild(Owner)
    local OwnerPos = OwnerObj.HumanoidRootPart.Position
    local StopAt = ((OwnerPos NewPet.Position) . magnitude 5) * 1000
    PetPos.P = StopAt
    PetPos.Position = OwnerPos + Vector3.new(0,10,0)
    PetGyro.CFrame = OwnerObj.HumanoidRootPart.CFrame
end
warped lily
#

remove spaces between ) . and magnitude

#

and

#

idk what

round burrow
#

still don't work

warped lily
#

the 5 is suppoed to be

warped lily
#

maybe you forgot a symbol or soemthing

#

id

#

k

round burrow
# warped lily its cause of the random 5

i don't think it's the 5, because the book had no previous errors for the script and i verified everything in the code, maybe roblox changed how the code work?

#

i will still try

warped lily
#

Its also just put there

round burrow
#

maybe

steel vaporBOT
#

studio** You are now Level 3! **studio

warped lily
#

YOu just scattered around bunch of things here

#

thats why

round burrow
#

oh thats working without ownerpos and the 5 now

#

idk why it was written on the book

#

so thanks for helping

warped lily
#

yeah well what you did with the 5 and ownerpos was like putting mayonaisse in shakespear macbet

grizzled gust
#

(OwnerPos NewPet.Position) there should be a - in there

vernal merlin
#

try not to rely too much on the book. I always try to understand everything that I write.