How would I add more to the table? Because in your way of doing it, your making rightpunch two times? Here is all my code:
local cas = game:GetService("ContextActionService")
local rs = game:GetService("ReplicatedStorage")
local UIS = game:GetService("UserInputService")
local events = rs:WaitForChild("Events")
local hitboxevent = events:WaitForChild("HitBox")
local plr = game.Players.LocalPlayer
local character = plr.Character or plr.CharacterAdded:Wait()
local hum = character:WaitForChild("Humanoid")
local animator = hum:WaitForChild("Animator")
local leftPunch = animator:LoadAnimation(script:WaitForChild("LeftPunch"))
local rightPunch = animator:LoadAnimation(script:WaitForChild("RightPunch"))
local middlePunch = animator:LoadAnimation(script:WaitForChild("MiddlePunch"))
local Block = animator:LoadAnimation(script:WaitForChild("Block"))
local Blockbreak = animator:LoadAnimation(script:WaitForChild("Blockbreak"))
local Blockhit = animator:LoadAnimation(script:WaitForChild("Blockhit"))
local Demproll = animator:LoadAnimation(script:WaitForChild("Demproll"))
local currentPunch = 0
local debounce = false
local holdingkey = false
local startfightstuff = false
local function punch()
local Blocking = character:FindFirstChild("Blocking").Value
print(Blocking)
if debounce then return end
if Blocking then return end
debounce = true
if currentPunch == 0 then
print('punch 0')
hitboxevent:FireServer(Vector3.new(3, 3, 3), Vector3.new(0, 0, -3.5), math.random(3, 8), 0.3)
rightPunch:Play()
task.wait(0.5)
debounce = false
currentPunch += 1
print(currentPunch)
elseif currentPunch == 1 then
print('punch 1')
hitboxevent:FireServer(Vector3.new(3, 3, 3), Vector3.new(0, 0, -3.5), math.random(3, 8), 0.3)
leftPunch:Play()
task.wait(0.5)
debounce = false
currentPunch += 1
print(currentPunch)
elseif currentPunch == 2 then
print('punch 2')
hitboxevent:FireServer(Vector3.new(3, 3, 3), Vector3.new(0, 0, -3.5), math.random(3, 8), 0.3)
rightPunch:Play()
task.wait(0.5)
debounce = false
currentPunch += 1
print(currentPunch)
elseif currentPunch == 3 then
print('punch 3')
hitboxevent:FireServer(Vector3.new(3, 3, 3), Vector3.new(0, 0, -3.5), math.random(3, 8), 0.3)
middlePunch:Play()
task.wait(0.5)
debounce = false
currentPunch += 1
elseif character:FindFirstChild("HitCounter").Value == 10 then
print('hello')
hitboxevent:FireServer(Vector3.new(3, 3, 3), Vector3.new(0, 0, -3.5), 25, 0.3)
print('done diddly doo')
Demproll:Play()
task.wait(1)
debounce = false
end
if currentPunch == 3 then
currentPunch = 0
else
currentPunch = 1
end
end
local function functiontoblock(ready)
if ready then
game.ReplicatedStorage.BlockBool:FireServer(true)
Block:Play()
game.ReplicatedStorage.BlockSpeed:FireServer(true)
elseif ready == false then
game.ReplicatedStorage.BlockBool:FireServer(false)
game.ReplicatedStorage.BlockSpeed:FireServer(false)
Block:Stop()
return
end
end
UIS.InputBegan:Connect(function(input, gpe)
if gpe then return end
local Blocking = character:FindFirstChild("Blocking").Value
if startfightstuff and input.UserInputType == Enum.UserInputType.MouseButton1 and not Blocking then
punch()
elseif input.KeyCode == Enum.KeyCode.Space and startfightstuff then
holdingkey = true
functiontoblock(true)
end
end)
UIS.InputEnded:Connect(function(input, gpe)
if gpe then return end
if input.KeyCode == Enum.KeyCode.Space and startfightstuff then
print('hi')
holdingkey = false
functiontoblock(false)
end
end)
game.ReplicatedStorage.StartFightMoves.OnClientEvent:Connect(function(ready)
if ready then
startfightstuff = true
elseif not ready then
startfightstuff = false
end
end)
game.ReplicatedStorage.IsBlocking.OnClientEvent:Connect(function(name, aretheyblocking)
if name == plr.Name then
if aretheyblocking then
Blockhit:Play()
end
end
end)