Humanoid WalkSpeed not taking effect

Hey devs, so im trying to get my humanoid to not move when an intro is playing. However the humanoid speed changed to 0 but the player can still move. Is this a new update from roblox or am i doing something wrong?

-- local intro = game:GetService("StarterGui"):WaitForChild("GameIntro")
local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local hum = char:WaitForChild("Humanoid")

if intro.Enabled == true and hum then
	
	print("GAME INTRO IS ENABLED!!!!!!!!!!!!!!!!!!!!!!!")
	hum.WalkSpeed = 0
	print(hum.WalkSpeed)
	
end

Is intro a screenGui because screenGuis have .Enabled

Roblox likes to change the Humanoid’s walkspeed after loading. So you have to set a changed event and update it back to 0 again. (Make sure not to make it loop)

local con = humanoid:GetPropertyChangedSignal("WalkSpeed"):Connect(function() 
   if humanoid.WalkSpeed ~= 0 then
      humanoid.WalkSpeed = 0
   end
end)
humanoid.WalkSpeed = 0

-- disconnect the connection when you set it back:
con:Disconnect()
hum.WalkSpeed = 16

Also the script is not under

but rather under Player.PlayerGui.GameIntro

Also another quick fix would be:

hum.WalkSpeed = 0
task.wait(5) -- you might have to change this
hum.WalkSpeed = 0

Oh didn’t see the first line, put the script in the gameIntroGui then intro = script.Parent

Firstly, you need to index the gui by PlayerGui, not StarterGui. StarterGui is a container which replicates its children to the Players PlayerGui (Player.PlayerGui).

Note that the if statement only runs once, so it won’t run again when the value is updated. You can use an event such as GetPropertyChangedSignal to detect when it changes and run your code then. Eg:

local player = game.Players.LocalPlayer
local playerGui = player.PlayerGui
local intro = playerGui:WaitForChild("GameIntro")

local char = player.Character or player.CharacterAdded:Wait()
local hum = char:WaitForChild("Humanoid")

intro:GetPropertyChangedSignal("Enabled"):Connect(function()
	if intro.Enabled ~= true and not hum then return end
	print("GAME INTRO IS ENABLED!!!!!!!!!!!!!!!!!!!!!!!")
	hum.WalkSpeed = 0
	print(hum.WalkSpeed)
end)

So i tried without the screengui in another studio and it worked i used this

local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local hum = char:WaitForChild("Humanoid")

if hum then

	hum.WalkSpeed = 0

end``` 
This worked but its not working in my own game and its starting to frustrate me because i know it should work

Unfortunately this doesnt work either

instead you should us this

local hmrp = char:WaitForChild("HumanoidRootPart")
hmrp.Anchored = true
1 Like

Bro just use the script I gave you:

local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local hum = char:WaitForChild("Humanoid")

if hum then
	local con = humanoid:GetPropertyChangedSignal("WalkSpeed"):Connect(function() 
		if humanoid.WalkSpeed ~= 0 then
			humanoid.WalkSpeed = 0
		end
	end)
	humanoid.WalkSpeed = 0

	task.wait(10) -- after the intro has ended
	con:Disconnect()
end

Else using

local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local hum = char:WaitForChild("Humanoid")

if hum then
	humanoid.WalkSpeed = 0

	task.wait(5)
	humanoid.WalkSpeed = 0
end

Finally another thing you can do is Anchor the HumanoidRootPart.

local root = char:WaitForChild("HumanoidRootPart")
root.Anchored = true

Is there any code above the code sample you gave us? Are there any errors in the output box?

OMG!!! THANK YOU SO MUCH!

1 Like

This doesnt work dude, otherwise i would have used it. And plus, i already tried that script and it dont work. So I anchored the hmrp

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.