I'm trying to make multiple parts to my crawl animation, these parts being:
Begin Animation (Get onto the ground)
Idle Animation
Crawl Animation (Main animation)
End Animation (Get up)
Issues:
Whenever the key "C" is held down, the player is meant to play the Begin Animation the animation does not play, as the Idle Animation plays instead.
The Idle Animation does play, but will not allow the Crawl Animation to play.
The Crawl Animation does not play as stated above.
The End Animation* plays fine, but after it plays it goes straight to the **Begin Animation starting it all over again.
Script:
Note: This script was taken originally as a free model but was edited to play multiple animations.
Player = game.Players.LocalPlayer repeat wait() until Player.Character Mouser = Player:GetMouse() name = Player.Name char = game.Workspace[Player.Name] AnimationIdle = script.AnimIdle Animation = script.Anim Begin = script.GetDown End = script.GetUp idletrack = char.Humanoid:LoadAnimation(AnimationIdle) begintrack = char.Humanoid:LoadAnimation(Begin) animtrack = char.Humanoid:LoadAnimation(Animation) endtrack = char.Humanoid:LoadAnimation(End) Mouser.KeyDown:connect(function(key) if key == "c" and char.Humanoid.Running == true then char.Humanoid.WalkSpeed = 0 begintrack:Play() wait(1) animtrack:Play() char.Humanoid.WalkSpeed = 4 char.Humanoid.JumpPower = 0 else if key == "c" then idletrack:Play() end end end) Mouser.KeyUp:connect(function(key) if key == "c" then char.Humanoid.WalkSpeed = 0 animtrack:Stop() endtrack:Play() char.Humanoid.WalkSpeed = 16 char.Humanoid.JumpPower = 50 end end)
Script Hierarchy
Game > StarterGui > Crawl > AnimIdle, Anim, GetDown, GetUp
Thank you in advance if you can help!
I don't understand what are you want doing but try that
--< Services local PlayerService = game:GetService('Players') local UserInputService = game:GetService('UserInputService') --< Variables local Player = PlayerService.LocalPlayer local name = Player.Name repeat wait() until Player.Character local char = Player.Character local AnimationIdle = script.AnimIdle local Animation = script.Anim local Begin = script.GetDown local End = script.GetUp local idletrack = char.Humanoid:LoadAnimation(AnimationIdle) local begintrack = char.Humanoid:LoadAnimation(Begin) local animtrack = char.Humanoid:LoadAnimation(Animation) local endtrack = char.Humanoid:LoadAnimation(End) --< Events UserInputService.InputBegan:Connect(function(input) if input.UserInputType == Enum.UserInputType.Keyboard and input.KeyCode == Enum.KeyCode.C and char.Humanoid.Running == true then char.Humanoid.WalkSpeed = 0 begintrack:Play() wait(1) animtrack:Play() char.Humanoid.WalkSpeed = 4 char.Humanoid.JumpPower = 0 elseif input.UserInputType == Enum.UserInputType.Keyboard and input.KeyCode == Enum.KeyCode.C then idletrack:Play() end end) UserInputService.InputEnded:Connect(function(input) if input.UserInputType == Enum.UserInputType.Keyboard and input.KeyCode == Enum.KeyCode.C then char.Humanoid.WalkSpeed = 0 animtrack:Stop() endtrack:Play() char.Humanoid.WalkSpeed = 16 char.Humanoid.JumpPower = 50 end end)