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
01 | local player = game.Players.LocalPlayer |
02 | repeat wait() until player.Character.Humanoid |
03 | local humanoid = player.Character.Humanoid |
04 | local mouse = player:GetMouse() |
05 |
06 | local S = game.Workspace.Seated |
07 | S.AnimationId = "http://www.roblox.com/asset/?id=933369397" |
08 |
09 | local SU = game.Workspace.StandingUp |
10 | SU.AnimationId = "http://www.roblox.com/asset/?id=935753167" |
11 |
12 | mouse.KeyDown:connect( function (key) |
13 | if key = = "x" then |
14 | local player S = humanoid:Animation(S) |
15 | S:Stop() |
Very minor fixes
01 | local player = game.Players.LocalPlayer |
02 | local humanoid = player.Character.Humanoid |
03 | repeat wait() until humanoid |
04 | local mouse = player:GetMouse() |
05 | local Seat = workspace.Seated --You could do workspace instead game.Workspace |
06 | S.AnimationId = "http://www.roblox.com/asset/?id=933369397" |
07 |
08 | local SU = workspace.StandingUp -- Same thing here |
09 | SU.AnimationId = "http://www.roblox.com/asset/?id=935753167" |
10 |
11 | mouse.KeyDown:Connect( function (key) --connect is depricated I reccommend Connect |
12 | if key = = "x" then |
13 | local S = humanoid:LoadAnimation(S) -- On your script that you showed me the variable had a space plus I changed the name |
14 | S:Stop() |
15 | local playAnim = humanoid:LoadAnimation(SU) |
Hopefully this helped you fix the script that you made :)