trying to make a explosive part that fire gets bigger the more damage it has taken / lower its health is
i currently got this
local TntHumanoid = script.Parent.TntHumanoid
local Fire = script.Parent.TntFire
local Smoke = script.Parent.Smoke
local TNTstate = 4
local HasExploded = false
function Damaged()
if HasExploded then return end
local Health = TntHumanoid.Health
local BaseNum = TntHumanoid.MaxHealth/3
local S3hp = TntHumanoid.MaxHealth
local S2hp = BaseNum*2
local S1hp = BaseNum
print(BaseNum)
if Health == TntHumanoid.MaxHealth and TNTstate ~= 4 then
TNTstate = 4
Fire.Enabled = false
Smoke.Enabled = false
end
if Health > S2hp and Health < TntHumanoid.MaxHealth and TNTstate ~= 3 then
TNTstate = 3
Fire.Enabled = true
Fire.Heat = 4
Fire.Size = 7
Fire.TimeScale = 1
Smoke.Enabled = false
end
if Health > S1hp and Health <= S2hp and TNTstate ~= 2 then
TNTstate = 2
Fire.Heat = 5
Fire.Size = 8
Smoke.Enabled = false
end
if Health < S1hp and Health > 0 and TNTstate ~= 1 then
TNTstate = 1
Smoke.Enabled = true
Smoke.Opacity = 0.1
Smoke.RiseVelocity = 0
Smoke.Size = 0.1
Smoke.TimeScale = 1
end
if Health <= 0 and TNTstate ~= 0 then
TNTstate = 0
Explode()
end
end
TntHumanoid:GetPropertyChangedSignal("Health"):Connect(function() Damaged() end)
It works sometimes, but not consistently enough.