Game security code

As others previously mentioned, whitespacing the code as much as possible is a bad idea, and is security through obscurity.

Looking at the code that has been beautified by railworks earlier:

local YU = game:GetService("Players")

local UI = YU.LocalPlayer
repeat
    wait()
until UI.Character

while true do
    wait(3.5)
    if UI.Character.Humanoid.WalkSpeed ~= 25 then
        UI:Kick("Unknown Command")
        wait(1)
    end
end

----

----

-----

I’m assuming that you are checking the player’s speed on the client. You shouldn’t do that because an exploiter can access all of the client-side scripts, including this one. They can edit this code and make the speed checking not able to happen at all.

I’d recommend checking the player’s speed on the server to prevent speeding in game. There are a couple of articles that explain how you should detect exploiting and implementing an anti-cheat for your game.

2 Likes