Ok so I’m making a horror game and I need to make it so when I touch an invisible brick I stop walking, but it just won’t work. As far as I know the line of code to stop walking is game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 0 am I right or why isn’t this working? The only reason I could come up with is that is is a server script instead of a local script. again I want it to make the player stop walking when they touch this part. Please help.
Could you show us how you set up the script? You will obviously need to use the Touched event since you are taking a player’s walk speed when they touch a part. You will also need to use the parameter because LocalPlayer can’t be used inside a server script.
Here is an article to help you with the touched event:
What do you mean?
Should it prevent the player from walking at all? Or should it just stop them until they press another movement key or wiggle the thumbstick on mobile/console? Or stop the for a second? Lots of different ways to go about it.
just stop them from walking at all
As I have said before, you can’t use LocalPlayer in a server script, you will need to use the touched parameter to locate the character.
ah I think I see what I did wrong thx. I specialize in local scripts so this is new to me.
Use
Part.Touched:Connect(function(hit)
Local Humanoid = hit.parent.Humanoid
If Humanoid then
Humanoid.WalkSpeed = 0
End
End)
Something like this I think
Bro u are a life saver this is correct and it works!!!
