while wait(10) do
for i, player in pairs(game.Players:GetPlayers()) do
print(playerPositions)
--if checkRank(player, 250) == true or game.ServerStorage.ProtonFiles.antiCheatExemptPlayers:FindFirstChild(player.Name).Value == true then
-- return
--end
local char = player.Character
local rootPart: BasePart = char:WaitForChild('HumanoidRootPart')
local oldPos = playerPositions[player.Name]['oldPos']
local newPos = playerPositions[player.Name]['newPos']
newPos = Vector3.new(rootPart.Position.X, 0, rootPart.Position.Z)
if oldPos and newPos then
print((oldPos-newPos).Magnitude)
if (oldPos-newPos).Magnitude >= 1000 then
player:Kick([[
Proton Anti-Exploit:
Player Character Violation
]])
end
oldPos = Vector3.new(rootPart.Position.X, 0, rootPart.Position.Z)
end
end
end
while wait(10) do
for i, player in pairs(game.Players:GetPlayers()) do
print(playerPositions)
--if checkRank(player, 250) == true or game.ServerStorage.ProtonFiles.antiCheatExemptPlayers:FindFirstChild(player.Name).Value == true then
-- return
--end
local char = player.Character
local rootPart: BasePart = char:WaitForChild('HumanoidRootPart')
playerPositions[player.Name]['newPos'] = Vector3.new(rootPart.Position.X, 0, rootPart.Position.Z)
local oldPos = playerPositions[player.Name]['oldPos']
local newPos = playerPositions[player.Name]['newPos']
if oldPos and newPos then
print((oldPos-newPos).Magnitude)
if (oldPos-newPos).Magnitude >= 1000 then
player:Kick([[
Proton Anti-Exploit:
Player Character Violation
]])
end
playerPositions[player.Name]['oldPos'] = Vector3.new(rootPart.Position.X, 0, rootPart.Position.Z)
end
end
end
local oldPos = playerPositions[player.Name]['oldPos'] or Vector3.new(0, 0, 0)
local newPos = playerPositions[player.Name]['newPos'] or Vector3.new(0, 0, 0)
You need a default value for both variables, you could use Vector3.new(0, 0, 0).