Problem, no errors shown but not working

  1. What do you want to achieve? Keep it simple and clear!
    I wanna make it so if the player WalkSpeed change to below or zbove 16 then the player get kicked.

  2. What is the issue? Include screenshots / videos if possible!
    I have no errors showed, but it’s do not work.

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I tried using the plauer model, refer to the workspace and nothing.

game.Players.PlayerAdded:Connect(function(plr)
if plr.Humanoid.WalkSpeed ~= 16 then
plr:Kick()
     end
end)
2 Likes

You didn’t give a reason why you kicked the player

1 Like

Use the GetPropertyChangedSignal event to detect whenever a Player’s Walkspeed changes, it’ll always be 16 on default no matter what

1 Like

I do not need a reason. It’s would auto say unspecified reason.

4 Likes

May you say were would I put it in my code?

1 Like

Humanoid isn’t part of player. You could also consider adding a CharacterAdded event to wait for the character to fully load

As @Jackscarlett suggested, GetPropertyChangedSignal is a good way to handle changes like this

game.Players.PlayerAdded:Connect(function(plr)
    plr.CharacterAdded:Connect(function(char)
        char.Humanoid:GetPropertyChangedSignal('WalkSpeed'):Connect(function()
            if char.Humanoid.WalkSpeed > 16 then
                plr:Kick()
            end
        end)
    end)
end)

But keep in mind that exploiters could still bypass this, them changing their walkspeed will not change on the server

2 Likes

It is a local script I use. So I do not see were they can change it.

1 Like

This is a local script? Exploiters can just disable it

2 Likes

Anti disable that I will make.

1 Like

W h a t

Just make it a Server Script, changing it to a Local Script (Even if you have a Anti-Disabled feature) will still make it exposed to hackers/exploiters

1 Like

And how would you do that? Don’t even trust the client; they can do anything.

Even if this is a server script, if a client changes their walkspeed, it won’t be detected on the server, therefore deeming your whole anti-cheat useless.

1 Like

What you given me in answer do not work either.

I discovered how to do it, welp that easy.

Maybe you should post the answer here in another comment? Other people may have this problem so if they stumble upon this post, you should probably describe what you did to fix it.

Also, judging by what this post looks like, the security on your anti-speed exploit is seriously flawed. Even if you have an anti-disable script on the client, they can disable that too. Also, if the anti-disable is on the server, the server won’t even see if the player disabled the script.

1 Like

You are using the PlayerAdded event which only triggers when a player joins, therefore, their walk speed which of course, will be 16, like many people said, you need to use GetPropertyChangedSignal.

The only good method I can think of is hiding the anti-disable in a crucial localscript that the game depends on.

Not really. Just because it is in a crucial script doesn’t mean they can’t edit the script. They can just straight up edit the script to remove the anti-disable. The only good way to do walkspeed checks is on the server by checking their velocity. If it is higher than a certain amount and they aren’t falling or something, kick them.

The reason is probably because they may be speed hacking if their speed is above the selected in the game settings, in this case, 16

Try this! This script had worked with my game.

game.Players.PlayerAdded:Connect(function(plr)
wait(4)
    if plr.character.Humanoid.WalkSpeed ~= 16 then
        plr:Kick()
    end
end)
1 Like

This won’t work in games that have many parts due to load times. In fact, this script is highly unreliable. Why not just use CharacterAdded? This will also break when they reset or die.

This is the correct way, and it uses .Changed:

game.Players.PlayerAdded:Connect(function(plr)
    plr.CharacterAdded:Connect(function(char)
        char:WaitForChild("Humanoid").Changed:Connect(function(property)
                if property == "Walkspeed" and char.Humanoid.Walkspeed ~= 16 then
                       plr:Kick()
                end
        end)
    end)
end)
2 Likes