This is a common question but I have not found a working solution. My game is FilterEnabled and this script will kick players who change their JumpPower, but it only works in the studio:
01 | local player = game.Players.LocalPlayer |
02 | local character = player.Character |
03 | if not character or not character.Parent then |
04 | character = player.CharacterAdded:wait() |
05 | end |
06 |
07 | local char = game.Players.LocalPlayer.Character:WaitForChild( "Humanoid" ) |
08 |
09 | while wait() do |
10 | if char.JumpPower ~ = 50 then |
11 | player:Kick( "Jumping to the moon is not allowed" ) |
12 | end |
13 | end |
It is a LocalScript and I placed it in StarterCharacterScripts
Try more efficient ways that won't distract your game resources:
01 | local player = game.Players.LocalPlayer |
02 |
03 | local onJumpPowerChanged = function () |
04 | player:Kick( "Jumping to the moon is not allowed" ) |
05 | end |
06 | local onCharacterAdded = function (char) |
07 | char.Humanoid:GetPropertyChangedSignal( "JumpPower" ):Connect(onJumpPowerChanged) |
08 | end |
09 |
10 | player.CharacterAdded:Connect(onCharacterAdded) |
11 | if player.Character then |
12 | onCharacterAdded(player.Character) |
13 | end |
1 | local player = game.Players.LocalPlayer |
2 | local character = player.Character |
3 |
4 | local char = game.Players.LocalPlayer.Character:FindFirstChild( "Humanoid" ) |
5 | while wait() do |
6 | if char.JumpPower ~ = 50 then |
7 | player:Kick( "Jumping to the moon is not allowed" ) |
8 | end |
9 | end |
Try that one, it worked for me. If it works accept my answer. Also add that to StarterGui.
Hkmag3, Having this type of anti-exploit script may not be the best idea. The local script is being processed by the HACKER'S COMPUTER, not Roblox Servers. This will make it MUCH easier for the hacker to prevent getting kicked.