hi,I’m very new to coding and I am trying to make it so the character doesn’t move during a specific scene. I wanted to know how I would simply make the walk speed 0, then make it back into the default (16 I believe?) using a script. I have looked online but I couldn’t find anything that was simple enough. would I use StarterPlayer since properties are in there for walk speed? I’m just pretty confused, thank you!
✓ ANSWER ACCEPTED
how to change walk speed with a script?
4 answers
✓ Accepted answer
You can use a LocalScript for this.
At a certain event you can
game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 0
or you can also do this with a player added event.
game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(character)
character.Humanoid.WalkSpeed = 0
end)
end)
local plr = game.Players.LocalPlayer
local char = plr.Character or plr.CharacterAdded:Wait()
char:WaitForChild("Humanoid").Walkspeed = 0
I suggest you start learning coding though, so that you dont have to ask as many questions and so that you fully understand what's told to you.
Accept the answer that helps!
game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(character)
character.Humanoid.WalkSpeed = 0
end)
end)
You can do this by making a script under workspace and pasting this into it:
function onPlayerEntered(newPlayer)
newPlayer.Character.Humanoid.WalkSpeed = 0
end
game.Players.ChildAdded:Connect(onPlayerEntered)
function onPlayerRespawned(newPlayer)
local Humanoid = newPlayer:findFirstChild("Humanoid")
if Humanoid ~= nil then
if game.Workspace:findFirstChild(Humanoid.Parent.Name) ~= nil then
Humanoid.WalkSpeed = 0
end
end
end
game.Workspace.ChildAdded:Connect(onPlayerRespawned)
This script ensures that if a player resets it still keeps the walk speed the same.
This discussion is preserved as it was. New answers, comments, and votes are closed.

4 comments
How have you been playing Roblox since 2013 and still don’t know how to code (no hate) lol just asking lol
haha I know right, I never really been into coding since it always “scared” me I guess? I know the basics and all, but I have most of the trouble when writing it out. actually most of my problems coding come from the scripts not running which was the case most of the time, but I want to make sure my code is right before testing everything for it not to work
when you start playing roblox has no bearing on how good you are to code. coding isnt something everyone does, dont feel ashamed
do