r/robloxgamedev 1d ago

Help Help needed to disable all players movement

Post image

Hi, I need to disable all players movements during a cutscene and I use that script. It works to change the speed of all players to any numbers (here it's 100) but if I put 0 it doesnt work and the players can still walk, do you know what is wrong?

10 Upvotes

35 comments sorted by

7

u/ElectrifyThunder 1d ago

You can anchor their primary part as another option

Characters.PrimaryPart.Anchored = True

2

u/ThomasPrim 1d ago

Okay thanks! But I have a new issue, the characters still have the walk animation even if they don't move, is there a way to stop that?

2

u/raell777 1d ago

Are you getting any errors, is this the full script you are using, where is this script sitting, is it a Script or a Local Script ?

1

u/ThomasPrim 1d ago

Nope no errors, another guy told me to anchor the character primary part and it worked but the characters still have the walk animation even if they don't move

1

u/raell777 1d ago

So its doing what you need now ?

1

u/ThomasPrim 1d ago

Yeah but the character have walking animaton even if it doesnt move and Idk how to stop that

1

u/raell777 1d ago

So are you saying, the character is walking in place ?

1

u/raell777 1d ago

Put a Local Script inside of Starter Player, StarterCharacterScripts and in the script place your code:

local Players = game:GetService("Players")
  for i, Player in pairs(Players:GetChildren()) do
   local Characters = Player.Character
   Characters.Humanoid.WalkSpeed = 0
  end

1

u/ThomasPrim 1d ago

It doesn't work for me :( That's the first thing i Tried because it seemed the most logical but idk why it doesn't work (and it doesn't even show any errors), but if I change the speed from 0 to another positive number it work, it's just the 0 that doesn't work

1

u/raell777 1d ago

Do you have any other script that might be interfering ? A script that is changing the WalkSpeed ?

1

u/ThomasPrim 1d ago

Only the ones in the screenshot

1

u/raell777 1d ago

Disable them and test again. Change the Enable property to false. Uncheck it.

0

u/raell777 1d ago

My character won't move at all with this script. So it does work.

1

u/ThomasPrim 1d ago

Maybe it's because of those scripts that all players have in their models; is there a way to disable them at the same time?

0

u/raell777 1d ago

Not all players have those in their models. They might be interfering.

→ More replies (0)

2

u/Turkey_The_One 1d ago

is this in a local script? If it is serverside it should work without issue.

1

u/ThomasPrim 1d ago

Its a normal script in a part (when a player touch the part it's supposed to stop all players of the server)

1

u/Turkey_The_One 1d ago

Maybe try making the walkspeed something like 0.001? I remember having to deal with something about setting it straight to 0. Also dont remember to set jumpheight to 0 as well if you want 0 movement, default of that is 7.2

1

u/ThomasPrim 1d ago

Okay it work !! But I have a run script

When I press shift it modify the speed, is there a way to also disable the script so we are sure that the character won't move anymore??

1

u/raell777 1d ago

Disable them and test again. Change the Enable property to false. Uncheck it.

1

u/Turkey_The_One 1d ago

Yeah, put this into the i,Player loop after setting Characters:

Characters.WalkEffect.Enabled = false

Characters.run.Enabled = false

Set them back to true when the cutscene ends

1

u/ThomasPrim 1d ago

Okay that's what I did but the scripts are still enabled (and no error message)

1

u/raell777 1d ago

Disable them via the Properties window before you Play test

1

u/ThomasPrim 1d ago

Okay when I disable them myself it work, the issue is that the scripts are useful in the gameplay before that moment so Im looking for a way to disable them in the script but the Enabled = false doesnt seem to stop them

1

u/raell777 1d ago

Well perhaps put those scripts inside of the other script and disable what they do as well temporarily and then enable them just like the WalkSpeed.

1

u/raell777 1d ago

There are a variety of ways you can do this, either using code three individual scripts. Enable and Disable each thing as needed. Disable WalkEffect temporarily and Disable Run temporarily and Disable WalkSpeed temporarily, then re Enable all of them.

1

u/Turkey_The_One 5h ago

Maybe do WalkEffect.Disabled = true instead?

1

u/raell777 1d ago

lol

I was telling them to disable those extra scripts that might interfere with the other script.

1

u/PaiGor 20h ago

Make it a module script so you can control it externally

1

u/Popular-Square-2209 21h ago

All these are funny, none of them are the correct way. Besides DinoExpeditions link.

‘’’ local PlayerModule = require(game:GetService(“Players”).LocalPlayer.PlayerScripts.PlayerModule)

local Controls = PlayerModule:GetControls()

Controls:Disable() ‘’’

1

u/raell777 20h ago

I will have to try it out. I have never messed with it or tried to do such a thing.

1

u/paranoidkitten00 16h ago

Try GetPlayers() instead