Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do I make this Anti-Speeding script work so it kicks cheaters?

So like I've done this script to remove cheaters from the game and I don't know what's wrong with it :(


local Players = game:GetService("Players")
local hackers = {
	
}

Players.PlayerAdded:Connect(function(plr)
 plr.CharacterAdded:Connect(function(character) 
	local cheater = character:WaitForChild("Humanoid") 
		if cheater.WalkSpeed > 16 or plr.Name == hackers then 
			hackers = {plr.Name}
			plr:Kick("You have violated the walk speed limit.") 
		end 
	end) 
end)

5 comments

0

Btw no errors

0

Try cheater.Changed:connect(function()

0

Because what your doing is only checking it once the players character has added, not when it has changed.

0

ohhh

0

accept an answer?

3 answers

hum = game.Players.LocalPlayer.Character:WaitForChild("Humanoid")
plr = game.Players.LocalPlayer

if hum.WalkSpeed < 20 then
game.Player.Kick.(plr.Name):Kick("Hacking")

2 comments

0

Where's "end" after the if statement? Also, there should be a variable for game.Players.LocalPlayer if you're going to use it several times.

0

Also your conditional statement evaluates to true when the walkspeed is less than 20, thus kicking all the players in game other than supposedly hackers.

****So basically I put it in the comments but this will fix it I believe...

local Players = game:GetService("Players")
local hackers = {

}

Players.PlayerAdded:Connect(function(plr)
 plr.CharacterAdded:Connect(function(character) 
    local cheater = character:WaitForChild("Humanoid") 
	cheater.Changed:connect(function()
      	  if cheater.WalkSpeed > 16 or plr.Name == hackers then 
           	hackers = {plr.Name}
          	plr:Kick("You have violated the walk speed limit.") 
       	 end 		
	end)
    end) 
end)

3 comments

0

didn't work and still nothing in f9

0

wrong serverscripts cant detect that

0

connect is deprecated. Use Connect instead.

game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(character)
		local humanoid1 = character:WaitForChild("Humanoid")
		local humanoid = character:FindFirstChildOfClass("Humanoid") -- so they cant rename humanoid
		humanoid.Running:Connect(function(speed)
			if speed > 17 then -- walkspeed kinda
				player:Kick('speeding')
			end
		end)
	end)
end)

pretty g00d

2 comments

0

default walkspeed is 16.

0

we know that.. humanoid.Running is an estimate.. sometimes its around 16.005

This discussion is preserved as it was. New answers, comments, and votes are closed.