Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by
Creacoz 210 Moderation Voter
5 years ago
Edited 5 years ago

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)
0
Btw no errors Creacoz 210 — 5y
0
Try cheater.Changed:connect(function() Odawg566 9 — 5y
0
Because what your doing is only checking it once the players character has added, not when it has changed. Odawg566 9 — 5y
0
ohhh Creacoz 210 — 5y
0
accept an answer? Imperialy 149 — 5y

3 answers

Log in to vote
-1
Answered by
Imperialy 149
5 years ago
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

0
default walkspeed is 16. WideSteal321 773 — 5y
0
we know that.. humanoid.Running is an estimate.. sometimes its around 16.005 Imperialy 149 — 5y
Ad
Log in to vote
-1
Answered by 5 years ago
Edited 5 years ago
hum = game.Players.LocalPlayer.Character:WaitForChild("Humanoid")
plr = game.Players.LocalPlayer

if hum.WalkSpeed < 20 then
game.Player.Kick.(plr.Name):Kick("Hacking")
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. Mr_Unlucky 1085 — 5y
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. AbstractionsReality 98 — 5y
Log in to vote
-1
Answered by 5 years ago

****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)

0
didn't work and still nothing in f9 Creacoz 210 — 5y
0
wrong serverscripts cant detect that Imperialy 149 — 5y
0
connect is deprecated. Use Connect instead. Mr_Unlucky 1085 — 5y

Answer this question