Hello i am working on an 'antiSpeed' type exploit thing and i want to know what is the best way to run this script for all the players at the same time ( and of course improvements):
for index, player in pairs(game.Players:GetChildren()) do -- not working i.e not looping in Studio dont know why
local StartLocation = player.Character.HumanoidRootPart.Position
wait(1)
local EndLocation = player.Character.HumanoidRootPart.Position
local finalLocation = EndLocation - StartLocation
local x = finalLocation.x
local z = finalLocation.z
print(finalLocation)
if x < 0 then
x = finalLocation.x - (finalLocation.x*2) -- to give a positive number
end
if z < 0 then
z = finalLocation.z - (finalLocation.z*2)
end
if x > 17 then
player:Kick("Do not cheat")
end
if z > 17 then
player:Kick("Do not cheat")
end
if x < 17 then
-- break the loop and goto to the next player
end
if x < 17 then
-- break the loop and goto to the next player
end
end
--forced player as in 'player = jack001214' i.e working when forced
Thanks,

2 comments
math.abs makes sure a number is positive
ahhah i knew there was a function to do this