Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do I get my run animation to play while i'm already walking?

I've been experiencing with my own custom animated sprint script and i'm having problems with the Animation starting when i'm running but not when i'm standing still. here is my method:

local UIS = game:GetService("UserInputService")
local Player = game.Players.LocalPlayer
local isSprinting = false

UIS.InputBegan:Connect(function(input)
	if input.KeyCode == Enum.KeyCode.LeftShift and isSprinting == false then
		isSprinting = true
		Player.Character.Animate.run.RunAnim.AnimationId = "http://www.roblox.com/asset/?id=5202688739"
		Player.Character.Animate.walk.WalkAnim.AnimationId = "http://www.roblox.com/asset/?id=5202688739"
		Player.Character.Humanoid.WalkSpeed = 25
		if input.KeyCode == Enum.KeyCode.W or input.KeyCode == Enum.KeyCode.A or input.KeyCode == Enum.KeyCode.S or input.KeyCode == Enum.KeyCode.D then
			local Track = Instance.new("Animation")
			Track.AnimationId = "rbxassetid://5202688739"
			local Anim = Player.Character.Humanoid:LoadAnimation(Track)
			Anim:Play()
		end		
	end
end)

UIS.InputEnded:Connect(function(input)
	if input.KeyCode == Enum.KeyCode.LeftShift and isSprinting == true then
		isSprinting = false
		Player.Character.Animate.run.RunAnim.AnimationId = "http://www.roblox.com/asset/?id=180426354"
		Player.Character.Animate.walk.WalkAnim.AnimationId = "http://www.roblox.com/asset/?id=180426354"
		Player.Character.Humanoid.WalkSpeed = 16
		if input.KeyCode == Enum.KeyCode.W or input.KeyCode == Enum.KeyCode.A or input.KeyCode == Enum.KeyCode.S or input.KeyCode == Enum.KeyCode.D then
			local Track = Instance.new("Animation")
			Track.AnimationId = "rbxassetid://180426354"
			local Anim = Player.Character.Humanoid:LoadAnimation(Track)
			Anim:Play()
		end		
	end
end)

3 comments

0

Did you set your animation to action in animation editor? If its at core then set it to action

0

ye try setting it to action

0

I wasn't having problems activating the animation I was having problems stopping the animation from activating if the Player wasn't already walking. Sorry if the Title mislead you

1 answer

Make Sure your Animation is actually set to Action, The System goes like this, Core -> Idle -> Movement -> Action, If your Using Animation Editor, Click the Three Dots, Proceed to Animation Priority and Choose Action.

1 comment

0

I wasn't having problems activating the animation I was having problems stopping the animation from activating if the Player wasn't already walking. Sorry if the Title mislead you.

This discussion is preserved as it was. New answers, comments, and votes are closed.