I have created an anti tp and anti speed which I am satisfied with but I was wondering if exploiters would be able to bypass it. It serversided but is there a way to trick the server in to thinking otherwise like if I need to check the players states.
Code:
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local MaxSpeed = 16
local PlayerAddedFunction = function(Player)
local CharacterAddedFunction = function(Character)
local PrimaryPart = Character.PrimaryPart or Character:GetPropertyChangedSignal("PrimaryPart"):Wait()
PrimaryPart = PrimaryPart or Character.PrimaryPart
task.wait(1)
local FormerPosition = nil
while true do
if FormerPosition then
local DeltaPosition = PrimaryPart.Position - FormerPosition
if math.floor(math.abs(DeltaPosition.X)) > MaxSpeed or math.floor(math.abs(DeltaPosition.Z)) > MaxSpeed then
Player:Kick("We're sorry, genuinely.")
end
end
FormerPosition = PrimaryPart.Position
task.wait(1)
end
return
end
Player.CharacterAdded:Connect(CharacterAddedFunction)
return
end
local Initialize = function()
Players.PlayerAdded:Connect(PlayerAddedFunction)
return
end
Initialize()
About the states, if I check if the player was running the exploiter could force the servers hand by making the player hover above the ground putting the State in freefall
1.) No, since it only checks on the X and Z axis falling will not affect anything.
2.) If I check to regularly (t < .1) then I lose on accuracy meaning it will detect only detect high changes. For example the maxspeed is 16 if I set the check intervals to .05 then it will detect player whoms velocity is 20 >
I did think of that and setting t to .1 seems to work best
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local d = 16
local t = 1 / 10
local PlayerAddedFunction = function(Player)
local CharacterAddedFunction = function(Character)
local PrimaryPart = Character.PrimaryPart or Character:GetPropertyChangedSignal("PrimaryPart"):Wait()
PrimaryPart = PrimaryPart or Character.PrimaryPart
task.wait(t)
local FormerPosition = nil
while true do
if FormerPosition then
local DeltaPosition = PrimaryPart.Position - FormerPosition
if math.floor(math.abs(DeltaPosition.X)) > d * t or math.floor(math.abs(DeltaPosition.Z)) > d * t then
Player:Kick("We're sorry, genuinely.")
end
end
FormerPosition = PrimaryPart.Position
task.wait(t)
end
return
end
Player.CharacterAdded:Connect(CharacterAddedFunction)
return
end
local Initialize = function()
Players.PlayerAdded:Connect(PlayerAddedFunction)
return
end
Initialize()
Players velocitites will not change if they teleport, and that can be easily bypassed by making a custom movement system by making incremental teleports with 1 second magnitude of 16 or more
Just spent like 30 minutes testing it out, and it is definitely exploit-proof. I tried tampering with the Character’s PrimaryPart, Humanoid, and the HumanoidRootPart as well as made scripts to bypass, but none of them worked.
Also, another thing I noticed is that it does fire off false positives when you’re on a conveyor or a moving platform, so might wanna fix that depending on what type of game you’re doing.
I tried that and set the character’s PrimaryPart to some part in workspace which had all of the HumanoidRootPart’s children, then I set the LowerTorso’s root constraint to that Part and didn’t die.
But even still, as long as the PrimaryPart is unchanged on the server, it is un-bypassable as far as I know.