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

Why doesn't my script work when a player's walkspeed is too fast?

I have a local script:

game.Players.LocalPlayer.Character.Humanoid.Changed:Connect(function(value)
	if game.Players.LocalPlayer.Character.Humanoid.WalkSpeed >= 30 then
		script.Parent.WSG.RemoteEvent:FireServer()
	end
end)

Nothing happens. It's not firing the remote event because I tried adding print("Fired") in the regular script.

4 comments

1

For starters you need to make sure that character exists, if you aren't waiting for character anywhere in your code - chances are it will be nil when your function is set up. You should also run a check on value to make sure it is WalkSpeed, more things change in Humanoid than you realize. Other than that - I don't see anything wrong with this.

1

Ah - you may also opt to have your event in a different location. If your event is somewhere inside of player (other than Backpack), it is my understanding that the server cannot reach it.

0

Note that hackers can also change their character's part physics instead of changing the WalkSpeed to speed hack

0

If one of the answerers helped you, please accept their answer. It is considered good manners and shows that you no longer need help.

3 answers

I don't understand what you're doing with your code. Humanoid changes lots of times. Why are you listening for the change? Also WalkSpeed likely has a maximum.

There probably is an error causing because the speed is increasing too high. Set a maximum to stop increasing.

6 comments

0

EDIT: I am not 100% sure of this answer. This is just a recommendation. Correct me if I'm wrong.

0

WalkSpeed does not have a cap. When it gets ridiculously high it may cause issues - but that is not what is wrong with his code. You can try this yourself. Go into Studio and run player.Humanoid.WalkSpeed = math.huge.

0

The entirety of the script is supposed to kick any player that goes faster than 30 walk speed

0

Where is your RemoteEvent located?

0

Thanks. @Jexpler This is a terrible way of doing that.

0

Then what's the better way of doing it?

I don't recommend doing the checks on the client. Use the PlayerAdded event and detect from there. It will not prevent a hacker from hacking if you stop their hacking on the client. They can just change it. As for why your current script is not working you can read this. I hope this helps and have a great day scripting!

4 comments

0

Doing some checks on the client that the server may not be able to check can help stop brainless skids (skid is script kiddie), but for those of experienced exploiters that understand how the scripts work it might be a problem.

0

^

0

The best way to prevent the experienced hacker is to not check their walkspeed because angel is correct in her answer. The best way to check is if they have a certain velocity, meaning, if they go a certain distance in a shorter than allowed time, you kick them

0

Or whatever it is you do to hackers

local Player = game:GetService("Players").LocalPlayer
local Char = Player.Character or Player.CharacterAdded:Wait()
local Hum = Char:WaitForChild("Humanoid")

Hum:GetPropertyChangedSignal("WalkSpeed"):Connect(function(Speed)
	if (Hum.WalkSpeed > 100) then
		print("Wow, that's really fast!")
	end
end)

This has to be checked locally as the walkspeed value does not replicate to the server. But it's also really risky as they can just delete the script even if you hide it, it will still be in their memory.

Hope this helped.

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