I am trying to achieve a combat system where the damage works normally and only when you punch.
if I punch and touch nothing and then touch someone it will damage them. As well if I punch and touch someone you can still damage him after punching
- I have made a post about this before but the problem seems to be back since I modified the script a bit.
local remote = game.ReplicatedStorage.remote local connection local function hitStuff(p,player) local canDamage = true local rightArm = player.Character:FindFirstChild("Right Arm") local LeftLeg = player.Character:FindFirstChild("Left Leg") if canDamage == true then canDamage = false rightArm.Touched:Connect(function(hit) local h = hit.Parent:FindFirstChild("Humanoid") if h then h:TakeDamage(10) canDamage = false connection:Disconnect() end end) end wait(0.5) connection:Disconnect() end connection = remote.OnServerEvent:Connect(hitStuff)