I'm trying to make a security script to prevent exploits. I cannot seem to find players. Where are they located? This is what I have.
game.Players.LocalPlayer.Character.Humanoid.Changed:connect(function() playerSpeed = game.Players.LocalPlayer.Character.Humanoid.WalkSpeed if playerSpeed > 16 then kick() end end)
What I thought this would do is see if Humanoid changed in any way. Then it would find WalkSpeed and if it went over the default speed, 16, that it would kick you. What am I doing wrong? Thanks for your help!
kick() doesn't kick them, use
game.Players.LocalPlayer:Kick()
However, you should add a variable for the player, example;
local player = game.Players.LocalPlayer player.Character.Humanoid.Changed:connect(function() if player.Character.Humanoid.WalkSpeed > 16 then player:Kick() end end)
If this helped or answered your question, accept the answer, it gives us both rep!