So, I’m developing a sword fighting / fencing arena with my friend, and I’m working on an anti-exploit for the game.
Simple run-down: A script in the ServerScriptService adds a script into the player’s StarterPack. The script checks for if any changes are made to the player’s gear and such
I’m having trouble, because some people are randomly getting kicked for supposedly changing the GripPos, even though they arent. It’s only happening to a single person every so often. I’ve checked all of the other scripts in the game, and none of them change the GripPos.
Here’s the code that checks if the GripPos is changed:
while wait() do
wrap(function()
-- Swords
for _,v in pairs(SwordNames) do
if Players.LocalPlayer.Character:FindFirstChild(v, false) then
if Players.LocalPlayer.Character:WaitForChild(v, math.huge).GripPos ~= Vector3.new(0, 0, -1.5) then
kick("Changing GripPos")
end
else
if Players.LocalPlayer.Backpack:WaitForChild(v, math.huge).GripPos ~= Vector3.new(0, 0, -1.5) then
kick("Changing GripPos")
end
end
end
-- Foils
for _,v in pairs(FoilNames) do
if Players.LocalPlayer.Character:FindFirstChild(v, false) then
if Players.LocalPlayer.Character:WaitForChild(v, math.huge).GripPos ~= Vector3.new(0, 0, -2.05) then
kick("Changing GripPos")
end
else
if Players.LocalPlayer.Backpack:WaitForChild(v, math.huge).GripPos ~= Vector3.new(0, 0, -2.05) then
kick("Changing GripPos")
end
end
end
end)()
end
end
Note that wrap() is referring to a variable, local wrap = corountine.wrap