when the player presses z they are seated and when they press x they play a standing up animation that leads into the idle animation
problem is the seated animation is looped and i don't know how to stop the Seated animation
local player = game.Players.LocalPlayer repeat wait() until player.Character.Humanoid local humanoid = player.Character.Humanoid local mouse = player:GetMouse() local S = game.Workspace.Seated S.AnimationId = "http://www.roblox.com/asset/?id=933369397" local SU = game.Workspace.StandingUp SU.AnimationId = "http://www.roblox.com/asset/?id=935753167" mouse.KeyDown:connect(function(key) if key == "x" then local player S = humanoid:Animation(S) S:Stop() local playAnim = humanoid:LoadAnimation(SU) playAnim:Play() wait(2) player.Character.Humanoid.WalkSpeed = 16 end end)
Very minor fixes
local player = game.Players.LocalPlayer local humanoid = player.Character.Humanoid repeat wait() until humanoid local mouse = player:GetMouse() local Seat = workspace.Seated --You could do workspace instead game.Workspace S.AnimationId = "http://www.roblox.com/asset/?id=933369397" local SU = workspace.StandingUp -- Same thing here SU.AnimationId = "http://www.roblox.com/asset/?id=935753167" mouse.KeyDown:Connect(function(key) --connect is depricated I reccommend Connect if key == "x" then local S = humanoid:LoadAnimation(S) -- On your script that you showed me the variable had a space plus I changed the name S:Stop() local playAnim = humanoid:LoadAnimation(SU) playAnim:Play() wait(2) humanoid.WalkSpeed = 16 end end)
Hopefully this helped you fix the script that you made :)