So I made a Hit Registration script, and I put debounce so that it doesn't allow somebody to damage another person more than once in a second. But for some reason, its still allowing the player to damage another player multiple times in a second. Here is the script (server script inside of the character, no errors):

ocal DmgDebounce = false

local Character = script.Parent

local Player = game.Players:GetPlayerFromCharacter(Character)

local Hitbox = Character["Right Arm"]

repeat wait() until Player.PlayerValues
repeat wait() until Player.PlayerValues.CanDamage
repeat wait() until Player.PlayerValues.CurrentAttackDmg

local CanDamage = Player.PlayerValues.CanDamage
local CurrentAttackDmg = Player.PlayerValues.CurrentAttackDmg

Hitbox.Touched:Connect(function(Hit)
	if DmgDebounce == true then return end
	if CanDamage.Value == false then return end
	
	print("CanDamage true")
	
	DmgDebounce = true
	
	if game.Players:GetPlayerFromCharacter(Hit.Parent) then
		local HitPlayer = game.Players:GetPlayerFromCharacter(Hit.Parent)
		
		wait(1)
		
		print("Barriers Passed")
		
		DmgDebounce = false
	end
end)

3 comments

0

I’m going to send you a friends req on Roblox and give you some tips and tricks

0

Where is the 'l' of 'local'? In the first line.

0

@IckyTheSuperior why don't you just give them here so other's can learn too?