local torso = script.Parent.Torso local h = script.Parent.Humanoid local spawnCF = script.Parent.Torso.CFRAME
function findPlaayer() for _,v in next, game.Players:GetPlayers()do if v.Character then local char = v.Character if char:FindFirstChild("Humanoid") and char:FindFirstChild("Torso")then local ptorso = char.Torso if(ptorso.Position - torso.Position).magnitude <= 30 then return v end end end end end return nil
while wait()do local player = findPlayer() if player ~= nil then h:MoveTo(player.Character.Torso.Position) else h:MoveTo(spawnCF.p) end end

2 comments
Probably just a typo. You set the variable for your function to findPlaayer() and then called it using findPlayer() Are you getting any errors in the output?
this is the error workspace.STONEGUARD.Follow:20:'' expected near 'while'