Hi, I'm making a custom model and I'm trying to animate with a walk cycle. I've got everything down except for the part where you call an the event in the humanoid, speed. Here's my script:
local Humanoid = script.Parent.Humanoid local animation = script.WalkAnim local animTrack = Humanoid:LoadAnimation(animation) local player = game.Players.LocalPlayer.Character
local Humanoid = script.Parent.Humanoid local animation = script.WalkAnim local animTrack = Humanoid:LoadAnimation(animation) local player = game.Players.LocalPlayer.Character player.Humanoid.Running:connect(function(speed) while wait(0.5) do print(speed) end if speed > 0 then print("Player is running") animTrack:Play() else print("Player has stopped") animTrack:Stop() end end)
I'm trying to make it so that when the character walks/its speed is greater than 0, it plays the walk cycle. I tried this in play mode, but it prints "Player has stopped" but never "Player is running" when I walk, I added the print(speed) to see what was happening and it's always printing 0, no matter what move I make. Any help? Thanks in advanc
local Humanoid = script.Parent.Humanoid local animation = script.WalkAnim local animTrack = Humanoid:LoadAnimation(animation) local player = game.Players.LocalPlayer.Character
player.Humanoid.Running:connect(function(speed) while wait(0.5) do print(speed) if speed > 0 then print("Player is running") animTrack:Play() else print("Player has stopped") animTrack:Stop() end end
end)
-- That is what you need?