I have tried for several months to make a successful walking animation. I have found out how to start the animation, but I don't know how to stop it when the player stopped walking.
--walking animation --Variables local UIS = game:GetService("UserInputService") local player = game.Players.LocalPlayer local char = player.character --Main UIS.InputBegan:connect(function(inputObject) if inputObject.KeyCode == Enum.KeyCode then local animation = Instance.new("Animation") animation.AnimationId = "https://www.roblox.com/asset?Id=1238381932" local PlayAnim = char.Humanoid:LoadAnimation(animation) PlayAnim:Play() end end)
then I used this to try and stop it.
player.Character.Humanoid.Running:connect(function(speed) local animation = Instance.new("Animation") animation.AnimationId = "https://www.roblox.com/asset?Id=1238381932" local player = game.Players.LocalPlayer local char = player.character PlayAnim = char.Humanoid:LoadAnimation(animation) if speed == 0 then PlayAnim:Stop() end end)
but, it does not work. I have tried before but failed. Can some one help me?
Roblox likes to be stupid when it comes to walking animations. Try this script below. If It doesn't work, try changing '0' at line 7 to '1'. If it still doesn't work, let me know and we can try something else.
player.Character.Humanoid.Running:connect(function(speed) local animation = Instance.new("Animation") animation.AnimationId = "https://www.roblox.com/asset?Id=1238381932" local player = game.Players.LocalPlayer local char = player.character PlayAnim = char.Humanoid:LoadAnimation(animation) if speed > 0 then PlayAnim:Play() else PlayAnim:Stop() end end)