I Have A Damage Script Inside Of A Part That Is Set To 0.2 Transparency By Another Script, The Code For The Damage Script:
local cooldown = true
script.Parent.Touched:connect(function(part)
if game.Players:FindFirstChild(part.Parent.Name) and script.Parent.Transparency == 0.2 and cooldown == true then
cooldown = false
part.Parent.Humanoid.Health = part.Parent.Humanoid.Health -math.random(180000,255000)
wait(1)
cooldown = true
end
end)
for some reason this does not work and i don't understand why. There are no errors in the dev console. However, the same script without a cooldown and transparency check works just fine
Working Script:
script.Parent.Touched:connect(function(part)
if game.Players:FindFirstChild(part.Parent.Name) then
part.Parent.Humanoid.Health = part.Parent.Humanoid.Health - math.random(180000,255000)
end
end)
Anyone know why the first script won't work?

2 comments
D E B U G
debug shows that the requirements aren't met somehow