I have this code for a sitting animation, I have a toggle script with it. Its looped in of its own (used an animation Editor) and it works that way. When I press Z, the character sits forever, when I press Z again it's supposed to stand up and keep walking, yet it doesn't!
local player = game.Players.LocalPlayer
repeat wait() until player.Character.Humanoid
local humanoid = player.Character.Humanoid
local mouse = player:GetMouse()
On = false
--ANIMATION--
local pushupanim = Instance.new("Animation")
pushupanim.AnimationId = "http://www.roblox.com/asset/?id=3408464847"
mouse.KeyDown:connect(function(key)
if key == "z" and On == false then
local playAnim = humanoid:LoadAnimation(pushupanim)
playAnim.Priority = Enum.AnimationPriority.Action
playAnim:Play()
humanoid.WalkSpeed = 0
On = true
elseif key == "z" and
On == true
then
local playAnim = humanoid:LoadAnimation(pushupanim)
playAnim.Priority = Enum.AnimationPriority.Action
playAnim:Stop()
humanoid.WalkSpeed = 16
On = false
end
end)
After the "elseif", the Humanoid.WalkSpeed = 16 Does work, yet the animation doesn't stop.

1 comment
The animation yet doesn't stop. I tried both methods and the result is still the same. As a mention, its a looping sitting animation.