I want to make it so when i’m doing damage with normal attacks or heavy, that I cannot do them at the same time like this. https://gyazo.com/37e8843aadf4dc4aa00a9dd98ad6a208
This is the first time me trying to make full combat system, using this video for assistance.
https://www.youtube.com/watch?v=vh8Ggpp_RR4
I would like information that would solve my problem and would improve the combat system as a whole.
Local Script
local ReplicatedStorage = game:WaitForChild("ReplicatedStorage")
local ComRemote = ReplicatedStorage:WaitForChild("Com")
local Player = game.Players.LocalPlayer
repeat wait() until Player.Character
local Character = Player.Character
local Mouse = Player:GetMouse()
local Humanoid = Character.HumanoidRootPart
local CombatReg = "CombatReg"
local CombatHeav = "CombatHeav"
Mouse.Button1Down:connect(function()
ComRemote:FireServer(CombatReg)
end)
Mouse.Button2Down:connect(function()
ComRemote:FireServer(CombatHeav)
end)
Server Script
Enabled = true
HeavEnabled = true
local ReplicatedStorage = game:WaitForChild("ReplicatedStorage")
local ComRemote = ReplicatedStorage:WaitForChild("Com")
local HeavyPunch = Instance.new("Animation")
--local HeavPunch = https://www.roblox.com/library/5362085988/ComPunch-Dummy
--local Animations = {Animation Stuff suppose to be here}
ComRemote.OnServerEvent:Connect(function(Player,Action,V1)
local Character = Player.Character
if Enabled == false then return end
if Action == "CombatReg" then
Enabled = false
for i,v in pairs(workspace:children()) do
if v:findFirstChild("HumanoidRootPart") and v:findFirstChild("Humanoid") and v:findFirstChild("debounce") == nil and v ~= Character then
if(v.HumanoidRootPart.Position-Character.HumanoidRootPart.Position).magnitude < 5 then
v.Humanoid:TakeDamage(5)
print("Regular Hit")
end
end
end
wait(0.31)
Enabled = true
if HeavEnabled == false then return end
elseif Action == "CombatHeav" then
HeavEnabled = false
for i,v in pairs(workspace:children()) do
if v:findFirstChild("HumanoidRootPart") and v:findFirstChild("Humanoid") and v:findFirstChild("debounce") == nil and v ~= Character then
if(v.HumanoidRootPart.Position-Character.HumanoidRootPart.Position).magnitude < 5 then
v.Humanoid:TakeDamage(15)
print("Heavy Hit")
end
end
end
end
end)