So basically, I want it so that when you press q you punch once with one hand, then the second time you press q it punches with other hand. I've gotten answers on another question, but I cannot add it to this type of script can someone help me? How do I add an If statement to a mouse.Keydown ? Is there any syntax mistakes?
local player = game.Players.LocalPlayer repeat wait() until player.Character.Humanoid local humanoid = player.Character.Humanoid local mouse = player:GetMouse() donefirstpunch = false local anim = Instance.new("Animation") anim.AnimationId = "http://www.roblox.com/asset/?id=892155490" local anim1 = Instance.new("Animation") anim.AnimationId = "http://www.roblox.com/asset/?id=897125858" mouse.KeyDown:connect(function(key) if key == "q" then local playAnim = humanoid:LoadAnimation(anim) playAnim:Play() local donefirstpunch = true end end) if donefirstpunch == true then mouse.KeyDown:connect(function(key) if key == "q" then local playAnim1 = humanoid:LoadAnimation(anim1) playAnim1: Play() donefirstpunch = false end end) end****
local player = game.Players.LocalPlayer repeat wait() until player.Character.Humanoid local humanoid = player.Character.Humanoid local mouse = player:GetMouse() move = 1 -- add this instead local anim = Instance.new("Animation") anim.AnimationId = "http://www.roblox.com/asset/?id=892155490" local anim1 = Instance.new("Animation") anim.AnimationId = "http://www.roblox.com/asset/?id=897125858" mouse.KeyDown:connect(function(key) if key == "q" and move == 1 then move = 2 -- change the value local playAnim = humanoid:LoadAnimation(anim) playAnim:Play() elseif key == "q" and move == 2 then move = 1 -- change the value again, but to the left punch --add block of code end end)