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

My Anti Speed hack script, is erroring..?

It says that the variable char is a nil value.

Any and all help appreciated.

local norunexploiting = true


function AntiSpeedHack()
	local plr = game.Players:GetChildren()
	local char = plr.Character
	local speed = 16
	
	if char.Humanoid.WalkSpeed >=speed then
		char:Destroy()
	while wait() do
		char:Destroy()
	end
	end
end

AntiSpeedHack()

3 comments

0

Speed hackers often don't actually change their speed - they mess with physics. FilteringEnabled is your best bet.

0

I would like to add this wiki article, it helps stop most speed hackers. http://wiki.roblox.com/index.php?title=Stopping_speed_hackers You still should definitely use FE, though.

0

why not get rid of the player from the server

2 answers

✓ Accepted answer

Hi,

[EDIT:] It is also to be noted that Perci1 and RemasteredBox have a good point. This script probably won't stop very many people from exploiting. There are indeed better ways of doing it.

It appears at line 5 you're creating a table type variable. In your case, plr is not a specific localplayer.

Simply put that in a localscript but change plr to localplayer .

To put what you did into perspective, it's like finding one name of all the people in a class. It just doesn't make sense.

Like so:

plr = game.Players.LocalPlayer

Put this script in a localscript....

local norunexploiting = true local plr = game.Players.LocalPlayer repeat wait() until plr.Character --Some don't like this, but I always put it...Up to you local char = plr.Character local speed = 16

function AntiSpeedHack()

if char:FindFirstChild("Humanoid").WalkSpeed >=speed then --Added FindFirstChild simply for efficiency
    char:Destroy()
while wait() do
    char:Destroy()
end
end

end

AntiSpeedHack()

4 comments

0

Spoonfed him, plus taught him a terrible way to do it. And terrible indentation. -1 if I could.

0

He had a question, I answered it. Get over it.

0

Fix your formatting please

0

Adding on, it checks if the walkspeed is greater than OR equal to, so upon loading in, their character would instantly be destroyed.

There are many ways for players to speed hack other than that. There is no reliable way of detecting this. The best you can do is compare player positions, and if they go too fast ban them.

Make sure to account for speed differences based on lag, tripping, teleporting, and whatever your game may do, as well as admin scripts.

Have fun!

2 comments

0

This, didn't tell me a single way to fix my current script, very informative but unhelpful, thank you however for your answer.

0

I did tell you how. I told you to compare player positions. If you need anything more, your incompetent to use even google. The other guy didn't even explain properly, and gave you a still >>very<< unreliable method. Honestly, you should have set my answer as the correct one.

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