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

Anti speed exploit not working?

So i'm making a anti speed haxor/exploit ting and for some reason, the script below, does not work.

game.Players.PlayerAdded:Connect(function(plr)
	if plr.Character.Humanoid.WalkSpeed >16 then
		plr:Kick('Exploiting')
	end
end)

Can anyone explain why? Thanks to whoever replys.

3 comments

0

You just asked for a reply so I guess i'll just say something random since I still don't know scripting but I still need help.

0

The modifications occur on the Client, which don't replicated to the Server in regulation to FE; the Server-sided Script will not recognize the change. You'll have to use a LocalScript. It's very difficult to maintain structure this way though, as using a RemoteEvent to disconnect the exploiter will also open opportunities for an exploiter to use it maliciously and subsequently disconnect—

0

—whomever they wish too.

4 answers

✓ Accepted answer

The character and the humanoid usually take sometime to load in, this is why you need to use CharacterAddedand :WaitForchild

CharacterAdded is similar to PlayerAdded except it detects the character being added. :WaitForChild() simply waits for a child of an object.

Not only that but it only checks once, so you'll need a loop.

So you would need to change your code like this:

game.Players.PlayerAdded:Connect(function(plr)
 plr.CharacterAdded:Connect(function(char)
   local humanoid = char:WaitForChild("Humanoid")
    while true do wait()
    if humanoid.WalkSpeed >16 then
        plr:Kick('Exploiting')
    end
    end
   end)
end)

Well, first off, your script won't work because it only checks once the player is added, and not constantly.

Second off, exploiters can easily get past an antiexploit like that. If you want any chance of defending your game from something like that, you should track the character's average movement per second.

plrAdded:Connect(function(plr)
    plr.CharacterAdded:Connect(function(char)
        while true do
            local oldCharPos = char.HRP.Position
            wait(1)
            local newCharPos = char.HRP.Position
        end
    end
end

from there, get the distance between the two positions, and make your judgement from there

I will point out that this script wont work for the same reason iiMegabyteGaming has said which is it only runs this script once which is when the player loads in, to make it constantly check you would have to add a loop like this:

game.Players.PlayerAdded:Connect(function(plr)
	plr.CharacterAdded:Connect(function(char)
		while true do
			if plr.Character.Humanoid.WalkSpeed >16 then
		        plr:Kick('Exploiting')
		    end
		end
	end)
end)

i also recommend adding the plr.CharacterAdded:Connect(function(char) because it will wait for the character to load in before running the script. so after you've added a loop comes your script which checks if the players speed is going above 16 or not, note that this can be bypassed by any teleport scripts but i have answered your question so i will end it here, if you would like me to help make a script to detect teleporting exploits then feel free to ask.

2 comments

0

That will not work, there is no wait() in the while loop and will just crash studio.

0

yh srry my bad lol forgot to add it.

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