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

Trying to check if walkspeed is 16 only and not over?

Asked by
innhale -2
5 years ago
local char = game.Workspace:FindFirstChild("Humanoid")

if char.walkspeed>16 then
    print("you hacker")
end


Workspace.Script:1: attempt to index a nil value is the error.

My intentions are to make sure no one is speed hacking in my game, sense filteredenabled doesn't cover that. I want to eventually ban the player for the game in the if statement, but I used print to make sure it works, which it doesn't.

0
You gotta find the player first. local char = game.Workspace:FindFirstChild("Humanoid") doesn't make much sense to me. TheWaterFoox 255 — 5y
0
Run a loop that checks like every four second if the player has the speed above 16. TheWaterFoox 255 — 5y

4 answers

Log in to vote
2
Answered by 5 years ago
Edited 5 years ago
game.Players.PlayerAdded:Connect(function(P) --When a player join this code run
    P.CharacterAdded:Connect(function(C) -- This check if the character spawned
        local Hum = C:FindFirstChild("Humanoid") --This find the humanoid
        Hum.Changed:Connect(function(Prop) -- This run when a property of the humanoid changes
            if Hum.WalkSpeed>16 then --If the walkspeed is superior to 16
                P:Kick("you hacker") --Kick the player 
            end
        end)
    end)
end)

I hope this help :)

0
It will. OP just needs to test it :D User#19524 175 — 5y
Ad
Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

Do you wan't help and there is the script:

local char = game.Players.LocalPlayer.Character.Humanoid
local player = game.Players.LocalPlayer

if char.WalkSpeed == 16 then
player:Kick("you hacker")
end
0
The default speed is 16. You will kick the player once they join XD User#22219 20 — 5y
0
lol User#21908 42 — 5y
Log in to vote
-1
Answered by 5 years ago
while true do
wait(.01)
local player = game.Players.LocalPlayer
local char = player.Char or player.CharacterAdded:()
if char.Humanoid.WalkSpeed >16 then
print("you're a hacker, be gone")
player:Kick("Exploiting")
wait(.01)
Log in to vote
-2
Answered by 5 years ago

Basicly u scripted it wrong.

-- Local Script
-- Put inside StarterGui

local player = game:GetService("Players").LocalPlayer
local char = player.Character
game.Players.PlayerAdded:Connect(function()
wait(0.1)
if char:WaitForChild("Humanoid").WalkSpeed = 16 then
print(Player.Name.. " is not a hacker."
else
print(Player.Name.. " is hacker."
end
end()
0
.PlayerGui.LocalScript:7: 'then' expected near '=' (red line under 16) innhale -2 — 5y
0
Hah you did too. User#19524 175 — 5y

Answer this question