I want this script to work whenever it detects an explosion in the workspace. I have an explosion that goes off everytime I run my game to see the script work, but this is also the only time it will work. It will not run unless an explosion happens right when the game starts.
Thanks for the help.
local health = script.Parent.Parent.Parent.Health
local explosion = workspace:WaitForChild("Explosion")
local function onHit(part,distance)
if part == script.Parent then
health.Value = health.Value - 10
print(health.Value)
wait(3)
script.Parent:Destroy()
else
end
end
explosion.Hit:connect(onHit)

1 comment
So the event was only connected to the first explosion and none else?