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

Help beginning and ending running animations?

Hello,

Was curious how I could to make it so when I run, an animation plays and then the instant I stop running it stops? Currently, the method Im using just is working like I want to, any help would be greatly appreciated.

game:GetService("UserInputService").InputBegan:Connect(function (inputObj, gameProccessedEvent)
	if not gameProccessedEvent and Active == true then
		
		if inputObj.KeyCode == Enum.KeyCode.W then
			if IsHolstering == false then
				IsHolstering = true
				Holster:Play()
			else 
				IsHolstering = false
				Holster:Stop()
			end
		end
	end
end)

I just did the basic Key input but there has to be a better way,

Thank you!

1 answer

Humanoid.Running:Connect(function(Speed)
	if Active then
		if Speed > 0 then
			Holster:Play()
			IsHolstering = true
		elseif Speed <= 0 then
			IsHolstering = false
			Holster:Stop()
		end
	end
end)

Figured it out....I think?

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