I'm trying to make a script to stop people from teleporting and I'm not getting any errors in Developer Console but its not working. Do you see anything wrong with the script?
local plr = game.Players.LocalPlayer
local char = plr.Character
while wait() do
local rootpart = char:FindFirstChild("HumanoidRootPart")
positionRecorder = {}
positionRecorder[1] = rootpart.Position
local pos1 = positionRecorder[1]
wait(0.1)
local pos2 = rootpart.Position
local mag = (pos1 - pos2).Magnitude
if mag >5 then
rootpart.CFrame = positionRecorder[1]
end
end
