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

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

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!

1 comment

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.

2 answers

✓ Accepted answer

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

1 comment

0

Thank you for helping me.

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

2 comments

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...

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)

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