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

How would I make an anti hack script based on the Local Player? (I have tried scripting it)

Asked by 8 years ago

Alright so here is what I have tried

player = game.Players.LocalPlayer

if player.Humanoid.WalkSpeed.Value > 16 then player:Kick ("You have been kicked for speed hacking")

end

if someone could help explain to why it does not work and then I could learn from my errors it would be great!

0
I'm not sure if you can kick from a local script but you would need to use a loop in order to repeatably check if the players walkspeed has changed. Or maybe try using a Player.Character.Humanoid.Walkspeed.Changed:connect(function() ect... You would want to use some WaitForChilds as well. User#11440 120 — 8y

2 answers

Log in to vote
-1
Answered by 8 years ago

The Humanoid is inside the character... Plus you only seem to run it once.

I recommend also adding a wait(0), allowing the rest of the instances to load. Add a while true do to check for different value, plus, humanoid walkspeed sometime's 16.2, 16.1, so I would recommend you to use math.floor . I hope this will help you:

wait(0)
player = game.Players.LocalPlayer

while true do
if math.floor(player.Character.Humanoid.WalkSpeed.Value) > 16 then player:Kick ("You have been kicked for speed hacking")
end
wait(0)
end
0
Thank you for helping me. Dark_Dimensions 96 — 8y
Ad
Log in to vote
0
Answered by 8 years ago

The Humanoid is not a part of the player found in Players. The humanoid is inside the player found in Workspace.

0
Or the "Character" In order to get the character you first get the player and use the ".Character" Or use the event "plr.CharacterAdded:connect(function() ect... User#11440 120 — 8y
0
I never knew that! Ive always tried to get the name of the player and then find it's physical properties by doing game.Workspace:FindFirstChild(Localplayer.Name) Volodymyr2004 293 — 8y

Answer this question