Basically, I want to make a pretty advanced combat system right now,
I thought about making it so when the players punches and presses space it would do a different attack aka fire a different remote.
How would I go about that?
Script:
local function Punch(animationnumber)
if animationnumber == 1 or animationnumber == 3 or animationnumber == 5 or animationnumber == 7 or animationnumber == 9 then
PunchAnim.AnimationId = 'rbxassetid://5207617104'
local PunchLoad = Char.Humanoid:LoadAnimation(PunchAnim)
PunchLoad:Play()
elseif animationnumber == 2 or animationnumber == 4 or animationnumber == 6 or animationnumber == 8 then
PunchAnim.AnimationId = 'rbxassetid://5212788793'
local PunchLoad = Char.Humanoid:LoadAnimation(PunchAnim)
PunchLoad:Play()
elseif animationnumber == 10 then
PunchAnim.AnimationId = 'rbxassetid://5212789739'
local PunchLoad = Char.Humanoid:LoadAnimation(PunchAnim)
PunchLoad:Play()
end
end
Mouse.Button1Down:Connect(function()
if ready and not Char:FindFirstChildWhichIsA("Tool") and InAMove == false then
InAMove = true
-- // Counting
PunchCount = PunchCount + 1
-- // Animations & Cooldown
Remote4:FireServer(PunchCount,Mouse.Hit)
spawn(function()
if PunchCount >= 10 then
PunchCount = 0
end
end)
Punch(PunchCount)
if PunchCount < 10 then
ready = false
wait(0.15) -- cooldown
ready = true
InAMove = false
else
ready = false
wait(1)
ready = true
InAMove = false
end
end
end)