So the HydraulicPress is supposed to damage the part only once, but it damages parts multiple times even if the part is in the blacklist.
local function destruction(HydraulicPress, number)
local blacklist = {}
HydraulicPress.Touched:Connect(function(touchedPart)
if touchedPart:FindFirstChild("HP") and table.find(blacklist, touchedPart) == nil then
table.insert(blacklist, touchedPart)
touchedPart.HP.Value -= HPandDMG.DMG[tostring(number)]
end
end)
end
this should work
believe the issue was that the .Touch was getting multiple parts of the player and since you only blacklisted a certain part at a time and not the whole player it kept doing damage for each part
local function destruction(HydraulicPress, number)
local blacklist = {}
HydraulicPress.Touched:Connect(function(touchedPart)
local Character = touchedPart.Parent
if touchedPart:FindFirstChild("HP") and not table.find(blacklist, Character.Name) then
table.insert(blacklist, Character.Name)
touchedPart.HP.Value -= HPandDMG.DMG[tostring(number)]
end
end)
end
the problem is, that the part i want to damage is an actual part that contains NumberValue in it, not a player. But your script gave me an idea and i think im going to implement a boolvalue which sets itself to true whenever the part is blacklisted.