Hey there! I am currently working on a game, and I am creating an anti exploit for it. This anti exploit stops players from changing their speed on the client. Here is my code:
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(char)
local hum = char:WaitForChild("Humanoid")
hum.Running:Connect(function(speed)
if speed > hum.WalkSpeed + 1 then
player:Kick("Lol nice exploits")
end
end)
end)
end)
This works, however, when they go on a conveyor belt, it detects it as an exploit, as they are walking faster than their walk-speed.
Any help would be greatly appreciated!
Edit: I have tried creating a value in the player and if they touch a conveyor it sets to true, but it is very buggy, and doesn’t work well AT ALL
Edit 2: This script is on the server, in case anyone didn’t know
Okay so there’s a lotta things I gotta say, bare with me:
NEVER put anti-exploit scripts on the client. The exploiter can EASILY delete the script, and render it completely useless
You may or may not be using a free model conveyor that modifies the humanoid’s walkspeed, thus the client anti exploit script picks it up
Don’t kick on the client. It doesn’t really work that well. Try kicking on the server using RemoteEvents.
I don’t suggest making anti-exploit scripts at all, because either way the exploiter would eventually bypass it anyway. Start investing more time into server-side security
The exploiter’s territory is the client, and the only bridge to the game is remote events and remote functions. This is why you need to have server-sided “if” checks, isntead of the client
Oh! My bad I thought you were doing that on the client
But anyways, on other terms that script won’t really do anything, since if an exploiter modifies their walkspeed, it’ll only appear the client, and it’ll appear normal on the server
No, as the humanoid.running() has 1 default argument, speed. This means you can check how fast the player is walking, and compare it to the player’s walkspeed on the SERVER. So if a player changes their speed on the client, it will kick them as their speed argument is more than their walkspeed on the server
if the player is above what you would consider exploiting, cast rays downwords and subtract the magnitude of the velocity from the hit object from the speed. but also i wouldnt kick them i find a “rubber band” effect is way better
Yes, you can. If you want, you can copy and paste the script into studio (On the server) and give it a try yourself. When you change the player speed on the client, it kicks you, but when you change it on the server, it doesn’t.
Maybe setting a limit for the player’s walk speed? So if the walk speed exceeds than, you can set it back.
There might be a problem with client-server.
the Running function just returns the characters overall speed, not there walkspeed, you are faster on a conveyor belt thus it returns that instead of its walkspeed
trying printing out “speed”, you will notice how it would be printing out numbers that aren’t your walkspeed often
I re-maken your code, cause there could be 2 whitelisted WalkSpeed. I don’t know why I re-maken it, but, honestly:
local whitelistedSpeed1 = 16
local whitelistedSpeed2 = convoyorspeedhere
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
local hum = character:WaitForChild("Humanoid")
if hum.WalkSpeed ~= whitelistedSpeed1 or whitelistedSpeed2 then
player:Kick("hi there ur hacks are cool now get out of here :)")
end
end)
end)