Basically, I’m trying to figure out why my debounces are universal for every player. Whenever one player tries to punch, it disables the combat for the other player and vice-versa.
I’ve already tried moving the script to StarterCharacterScripts, and at this point I’m extremely lost.
Directory: gyazo.com/12896aa169f793795a370472b8ff5b63
CODE:
--client
local plr = game.Players.LocalPlayer
local mouse = plr:GetMouse()
local UIS = game:GetService("UserInputService")
--combat
mouse.Button1Down:Connect(function()
game.ReplicatedStorage.combore:FireServer({Fire = "Combat", Type = "Light"})
end)
--blocking
UIS.InputBegan:Connect(function(input, gpe)
if input.KeyCode == Enum.KeyCode.F and not gpe then
game.ReplicatedStorage.combore:FireServer({Fire = "Block", Type = true})
end
end)
UIS.InputEnded:Connect(function(input, gpe)
if input.KeyCode == Enum.KeyCode.F and not gpe then
game.ReplicatedStorage.combore:FireServer({Fire = "Block", Type = false})
end
end)
--server
local damage = require(game.ServerScriptService.Modules.Damage)
local region = require(game.ServerScriptService.Modules.RotatedRegion3)
local combo = 0
local last = tick()
local block = false
local cd = false
local anims = game.ReplicatedStorage.anims
local sounds = game.ServerStorage.Sounds
CombatInfo = {
Damage = 5,
Stun = 0.5,
Knockback = 7,
KnockbackDir = nil
}
local hitbox = function(char, tab)
local victim = {}
for _, v in pairs(workspace.humans:GetChildren()) do
local reg = region.new(char.HumanoidRootPart.CFrame * CFrame.new(0,0,-3), 4.27, 3.24, 5.49)
if reg:castPart(v:FindFirstChild("HumanoidRootPart")) then
if not v:FindFirstChild("Blocking") then
local hit = sounds.hit:Clone()
game:GetService("Debris"):AddItem(hit, .6)
hit.Parent = char
table.insert(victim, v)
damage.Handle(victim, tab)
hit:Play()
else
local blockse = sounds.blocksound:Clone()
blockse.Parent = char
blockse:Play()
game:GetService("Debris"):AddItem(blockse, .5)
end
end
end
end
game.ReplicatedStorage.combore.OnServerEvent:Connect(function(player, args)
if cd then return end
local char = player.Character
local hum = char.Humanoid
local blockanim = hum:LoadAnimation(anims.block)
if args.Fire == "Combat" and not block then
cd = true
local currinfo = {Hitter = player.Name}
for i,v in next, CombatInfo do
currinfo[i] = v
end
if not currinfo.KnockbackDir then
currinfo.KnockbackDir = player.Character.HumanoidRootPart.CFrame.LookVector * 1
end
local ok = function()
if args.Type == "Light" then
local anim = hum:LoadAnimation(anims["hit"..combo])
local woosh = sounds.woosh:Clone()
woosh.Parent = char
woosh:Play()
anim:Play()
wait(.3)
hitbox(char, currinfo)
combo = combo + 1
print(combo)
wait(.15)
woosh:Destroy()
cd = false
end
end
if tick() - last and combo < 2 then
ok()
else
combo = 0
ok()
end
last = tick()
elseif args.Fire == "Block" and args.Type then
local blockfold = Instance.new("Folder", char)
blockanim:Play()
block = true
hum.WalkSpeed = 9
blockfold.Name = "Blocking"
print("Block")
elseif args.Fire == "Block" and not args.Type then
blockanim:Stop()
hum.WalkSpeed = 16
game:GetService("Debris"):AddItem(char:FindFirstChild("Blocking"), .1)
block = false
print("Unblock")
end
end)
All help is appreciated.