So im making a click combat script, im currently working on the clients side. Im using an intiger value since i want more than 2 clicks, and i have an animation for each click. The script is working but not in the way i intended
I want the script to run like “Click 1, animation 1 play. Click 2, animation 2 play. Click 3, animation 3 play. Wait. Repeat”
local player = game:GetService("Players").LocalPlayer local char = player.Character or player.CharacterAdded:Wait() local hum = char:WaitForChild("Humanoid") local rPunch = script.Punch2 local lPunch = script.Punch2 local UIS = game:GetService("UserInputService") local number = 1 local pauseTime = .98 local debounce = false local TS = game:GetService("TweenService") local rTrack = hum.Animator:LoadAnimation(rPunch) local lTrack = hum.Animator:LoadAnimation(lPunch) UIS.InputBegan:Connect(function(input, chat) if chat then return end if input.UserInputType == Enum.UserInputType.MouseButton1 and not debounce then debounce = true if number == 1 then rTrack:Play() wait(.5) number = 2 print(number) elseif number == 2 then lTrack:Play() wait(.5) number = 3 print(number) elseif number == 3 then rTrack:Play() wait(4) number = 1 print(number) end wait(3) debounce = false end end)
for some reason its only playing 1 animation, so im assuming only part of the code is running.
Help and feedback is appreciated, thank you for your time