So my game is a horror game where people rely a lighter to keep their sanity, to prevent people from abuse the lighter (always keep the lighter on, spamming on and off) I want the lighter to have a cooldown system for example: when player activate the lighter, the fire will stay for 30 seconds then it will disappear and player have to wait 60 seconds to activate the lighter again and repeat , when player activate the lighter after using it, it still spark and have the sounds but the fire won’t appear
I have not archive anything so far
Here is he script I use for the lighter
Tool = script.Parent
function onActivated()
if Tool.Fire.Value == false then
Tool.Effects.Fire.Enabled = true
Tool.Effects.Flare.Enabled = true
Tool.Effects.Light.Enabled = true
Spark()
Tool.Fire.Value = true
Tool.Enabled = false
Tool.Effects.On.Playing = true
wait(0.25)
Tool.Enabled = true
else
Tool.Effects.Fire.Enabled = false
Tool.Effects.Flare.Enabled = false
Tool.Effects.Light.Enabled = false
Tool.Fire.Value = false
Tool.Enabled = false
wait(0.25)
Tool.Enabled = true
end
end
function Spark()
Tool.Effects.Sparks.Enabled = true
Tool.Handle.Spark:Play()
wait(0.1)
Tool.Effects.Sparks.Enabled = false
end
function onUnequipped()
Tool.Effects.Fire.Enabled = false
Tool.Effects.Flare.Enabled = false
Tool.Effects.Light.Enabled = false
Tool.Fire.Value = false
end
script.Parent.Activated:connect(onActivated)
script.Parent.Unequipped:connect(onUnequipped)