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

I made a tool. That is supposed to do punches. But I can't make it shuffle through animations! Help?

Problem: I made a tool which is for combat. So every time you click it plays a punch animation. But I want it so that if you click you do a right punch. And if you click again you do a left punch. I don't know how to do this. Can someone help me?

Tool = script.Parent
Player = game.Players.LocalPlayer
PunchDebounce = true
Tool.CanBeDropped = false

Tool.Activated:connect(function()
	Tool.Enabled = true
	if not PunchDebounce then return end
	PunchDebounce = false
	local a = Player.Character.Humanoid:LoadAnimation(script["Punch R6"])
    a:Play()
    wait(.8)
    PunchDebounce = true
end)


1 answer

You could do a function where the aniamtion plays and for example you change a value like

local punched = true

Then if that value is true then you play the left animation and change it back to false,if it isn't play the right animation

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