Hello there!
this script don`t work
while true do
if game.Player.LocalPlayer.Character.Humanoid.WalkSpeed ~= 16 Then
game.Player.LocalPlayer:kick()
end
end
Hello there!
this script don`t work
while true do
if game.Player.LocalPlayer.Character.Humanoid.WalkSpeed ~= 16 Then
game.Player.LocalPlayer:kick()
end
end
well it wont kick if the user’s speed is 16. also that you should put that in a while wait() loop so it constantly checks.
also the character may not exist so you may want to put this into a startercharacterscript.
It won’t work if its a normal script it has to be local, What kind is it?
put local script in startercharacter script. put this code in:
local char = script.Parent
char:WaitForChild("Humanoid").Changed:Connect(function()
if char.Humanoid.WalkSpeed ~= 16 then
game.Players.LocalPlayer:Kick("not today kid")
end
end)
This would only check the player’s walkspeed once
This is will constantly check if the player’s walkspeed is not 16:
repeat wait(1) until game:IsLoaded() -- waits until the game is loaded
while wait() do -- constantly checks if the player's walkspeed is not 16
if game.Player.LocalPlayer.Character.Humanoid.WalkSpeed ~= 16 Then
game.Player.LocalPlayer:kick()
end
end
If this is a client-based anti-cheat, do not use this. Exploiters can easily bypass it.
Anyways, you made it only fire once, so putting it into a .Changed function or in a loop might solve your problem.
It should stop about 90% of exploiters though it’s true that they shouldn’t depend on only having a client based anti exploit.
Client-side anti-exploits are pretty much useless. If an exploiter is interested in your game, it will be bypassed easily. I don’t think you can kick the LocalPlayer from a LocalScript either.
You should use a server-sided anti-exploit. If you are not very experienced yet, don’t focus to much on creating an anti-exploit. In my opinion, anti-exploits like speed, flying, flinging, etc. should be done when your game is release-ready and they should be adapted to your game.
This doesn’t apply to anything else! Never trust the client. Especially not with RemoteEvents.
Good luck on your project
Clientsided anti-exploits can be bypassed, exploiters use metatables to make the client think that the WalkSpeed is set to 16 (default walkspeed) and sometimes bypass kicks if it was done on the client.
But the reason is because your script is only checking for the walkspeed when the script starts to run.
Use a Instance.GetPropertyChangedSignal or Instance.Changed event to fix this.
You can’t kick a player on the client due to FilteringEnabled. You have to fire a remote event to the server and then pick it up there and kick the user from there. Also, you should probably say :Kick()
instead of :kick()
.
https://developer.roblox.com/en-us/api-reference/function/Player/Kick
When used from a
LocalScript
, only the local player’s client can be kicked.
It definitely works but specifies that the client can’t kick other clients.
Like all the replies below, this would be useless against cheaters.
They can easily bypass this by deleting the script or something else.
Here’s an example, you can make a server script instead that checks the player’s HumanoidRootPart’s position every few seconds or frames.
If the position is too far from the previous position, then kick them.
That is False, I have many times made a server side “player kick” for an anti-cheat system.
You can clearly see its a local script, because of "LocalPlayer"
.
Try this:
game.Players.PlayerAdded:Connect(function(player)
while wait() do
if player.Character.Humanoid.WalkSpeed ~= 16 then
player:kick()
end
end
end)
Put this in a server side script. (while this works, its not effective against modern-day exploits)
You should probably use GetPropertyChangedSignal or Changed instead of using a while wait() loop
The character may not load right away use CharacterAdded
Changes from the client don’t replicate to the server (for example if a exploiter changes their walkspeed to 100 then the server cant see that)
This wouldn’t work. If the client changes their walkspeed it won’t replicate to the server. You’re also polling for no reason, there’s an event for this!
I would put it in a loop so it checks the players walkspeed every 3 seconds.
while wait(3) do
if game.Player.LocalPlayer.Character.Humanoid.WalkSpeed > 16 Then
game.Player.LocalPlayer:Kick()
end
end
Doing this is effectively useless, all an exploiter has to do is type one command and the Local Script is deleted. You should aim to do this on the server, not the client. You can achieve this my doing magnitude checks. You can refer to these posts:
There’s no such thing as game.Player
, it’s game.Players
.