-
What do you want to achieve? Keep it simple and clear!
I’d like for there to be a 5 second cooldown in between dealing damage to the same player. -
What is the issue? Include screenshots / videos if possible!
-
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
The script below is the only solution I’ve tried.
local blacklist = {}
script.Parent.Touched:Connect(function(toucher)
local numberPosition = 0
local actualNumberPosition = tonumber(numberPosition)
if toucher.Parent.Name ~= script.Parent.Parent.Name and not table.find(blacklist, toucher.Parent.Name) and toucher.Parent:FindFirstChild("Humanoid") then
numberPosition = numberPosition + 1
actualNumberPosition = tonumber(numberPosition)
toucher.Parent.Humanoid.Health = toucher.Parent.Humanoid.Health - 10
table.insert(blacklist, toucher.Parent.Name, actualNumberPosition)
wait(5)
table.remove(blacklist, actualNumberPosition)
end
end)
I’m new to tables, so I might be making a stupid mistake.