Hello there,I was making one of my character’s melee and I was thinking about making combo reset but I don’t know how to make it because I never made it before,if someone can help me then here’s my script:
--VARIABLE--
local hbm=require(game.ReplicatedStorage.MODULE.MuchachoHitbox)
local turn=script.Parent.Gohei.Turn.Value
local TS=game:GetService("TweenService")
--WELDERS
game.ReplicatedStorage.CharacterEvent.Reimu.OnServerEvent:Connect(function(player)
local Character=player.Character
Character.CharacterUsing.Value="Reimu"
local Rhand = Character["Right Arm"]
player.Character.Animate:Destroy()
local animate=script.ReimuAnimate:Clone()
animate.Parent=player.Character
animate.Disabled=false
script.Parent.Skills.Visible=true
animate.Enabled=true
local Part = Instance.new("Part",Character)
Part.Name = "GoheiHandle"
Part.CanCollide = false
Part.Transparency = 1
Part.Size = Vector3.new(0.5,0.5,0.5)
local SFX=script.Parent.Gohei.PlayerSFXFolder:Clone()
SFX.Parent=player.Character
local MT6D = Instance.new("Motor6D",Rhand)
MT6D.Part0 = Rhand
MT6D.Part1 = Part
MT6D.C0 = CFrame.new(0,0,0)
script.Parent.Skills.Visible=true
local Gohei = script.Parent.Gohei.Gohei:Clone()
Gohei.Parent = Character
Gohei.Anchored=false
local Weld = Instance.new("Weld",Part)
Weld.Part0 = Part
Weld.Part1 = Gohei
Weld.C0 = CFrame.new(0,0,0)
end)
--END--
--ATTACKS
--M1
game.ReplicatedStorage.CharacterEvents.ReimuHakurei.Punch.OnServerEvent:Connect(function(player)
if player.Character:FindFirstChild("UsingSKill") then return end
if player.Character:FindFirstChild("Stun") then return end
if player.Character:FindFirstChild("IsBlocking") then return end
if player.Character.Dashing.Value==true then return end
if player.Character.CharacterUsing.Value~="Reimu" then return end
local hum=player.Character:FindFirstChildWhichIsA("Humanoid")
local hrp=player.Character:FindFirstChild("HumanoidRootPart")
local animtor=hum:FindFirstChildWhichIsA("Animator")
local turn=script.Parent.Gohei.Turn.Value
local hitbox=hbm.CreateHitbox()
turn+=1
hitbox.CFrame=hrp
hitbox.Size=Vector3.new(5,5,5)
hitbox.Offset=CFrame.new(0,0,-3.5)
hitbox:Start()
hitbox.Touched:Connect(function(hit)
local EnemyHum=hit.Parent:FindFirstChild("Humanoid")
if hit.Parent.Name~=player.Name then
if EnemyHum~=nil then
local hrp=hit.Parent:FindFirstChild("HumanoidRootPart")
local Block=hit.Parent:FindFirstChild("IsBlocking")
local Enemy=hit.Parent
if hrp~=nil then
if Block==nil then
EnemyHum:TakeDamage(1)
local stun = game.ReplicatedStorage.Stun:Clone()
stun.Parent=hit.Parent
game.ReplicatedStorage.MakeHitEffect:FireAllClients(Enemy)
task.wait(0.5)
stun:Destroy()
end
end
end
end
end)
if turn == 1 then
local Animation=animtor:LoadAnimation(script.P1)
Animation:Play()
end
if turn == 2 then
local Animation=animtor:LoadAnimation(script.P2)
Animation:Play()
end
if turn == 3 then
local Animation=animtor:LoadAnimation(script.P3)
Animation:Play()
end
if turn == 4 then
local Animation=animtor:LoadAnimation(script.P4)
Animation:Play()
end
if turn == 5 then
local Animation=animtor:LoadAnimation(script.P1)
Animation:Play()
end
if turn == 6 then
local Animation=animtor:LoadAnimation(script.P5)
Animation:Play()
turn=0
end
task.wait(0.3)
hitbox:Stop()
end)
--M2