Hitbox.Touched:Connect(function(Hit)
local HitPlayerFolder = Instance.new("Folder")
HitPlayerFolder.Name = ("QFrom"..plr.name)
HitPlayerFolder.Parent = script
if Hit.Parent:FindFirstChild("Humanoid") then
if Hit.Parent.Name == plr.name or HitPlayerFolder:FindFirstChild(Hit.Parent.Name) then
print("This Player Has Already Been Hit or This Player Is The Justsu Caster")
else
local NewHitPlayer = Instance.new("ObjectValue") -- Here it starts creating a hitplayer
NewHitPlayer.Parent = HitPlayerFolder
NewHitPlayer.Name = Hit.Parent.Name
Hit.Parent.Humanoid:TakeDamage(20)
local HitPlayer = game.Players:GetPlayerFromCharacter(Hit.Parent)
HitPlayer.PlayerGui.MainUI.KG.SharinganSleep.Visible = true
wait(2)
HitPlayer.PlayerGui.MainUI.KG.SharinganSleep.Visible = false
end
HitPlayerFolder:Destroy()
wait(2)
Hitbox:Destroy()
end
end)
end
So this damage script is has a bug where 1 player gets hit mulptiple times until they die while they only should be hit ONCE i tought solving this by adding a player to a folder then checking if the player was in the folder
Deleting the hitbox is not a option or only 1 player can be hit instead of multiple!
How can i fix this issue
