basically , in my rpg I want it so that if my enemy goes a certain distance from the spawnpoint (I can just use a block) then it walks back to the spawnpoint, so I was wondering if there was a way to measure the stud distance and make it so that it returns to normal spawn.. any help guys ?
if dist >= 10 then script.Parent.Human:MoveTo(pos) -- dist being the stud distance , and pos being the spawnpoint (e.g) end
Idk something like that... thanks , any help appreciated
local spawnPoint -- define spawnpoint local studDistance = 10 -- maximum distance from spawn allowed while true do local dist = (spawnPoint.Position - script.Parent.Torso.Position).magnitude if dist >= studDistance then script.Parent.Human:MoveTo( spawnPoint.Position, spawnPoint) wait(1) end end
If you have any questions ask.