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
6 years ago
1local char = game.Workspace:FindFirstChild("Humanoid")
2 
3if char.walkspeed>16 then
4    print("you hacker")
5end

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 — 6y
0
Run a loop that checks like every four second if the player has the speed above 16. TheWaterFoox 255 — 6y

4 answers

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

I hope this help :)

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

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

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

Basicly u scripted it wrong.

01-- Local Script
02-- Put inside StarterGui
03 
04local player = game:GetService("Players").LocalPlayer
05local char = player.Character
06game.Players.PlayerAdded:Connect(function()
07wait(0.1)
08if char:WaitForChild("Humanoid").WalkSpeed = 16 then
09print(Player.Name.. " is not a hacker."
10else
11print(Player.Name.. " is hacker."
12end
13end()
0
.PlayerGui.LocalScript:7: 'then' expected near '=' (red line under 16) innhale -2 — 6y
0
Hah you did too. User#19524 175 — 6y

Answer this question