You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
I want to achieve a power generator that when turned on, will make a light go on but will drain fuel, when the fuel value reaches 0 it turns off the light and after some time it refills itself and turn the stuff back on -
What is the issue? Include screenshots / videos if possible!
It worked till a point, it turns on, the fuel goes down, but when it reaches 0 it just stops the script that makes the fuel go down but dont turns anything off, if i turn off/on the light it continues going down -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
tried to mess around with the position of the scripts and change them a bit, nothing worked, some even broke it
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
local ptlight = script.Parent.Parent.Parent.Parent.Light.LightObject.PointLight
while true do
if script.Parent.Parent.Gas.Value == 0 then
script.Parent.Enabled = false
ptlight.Enabled = false
script.Disabled = true
script.Parent.Script.Enabled = false
end
end
script thats supposed to turn off things
while true do
wait()
if script.Parent.Gas.Value == 0 then
script.Parent.GasScript.Disabled = true
wait(30)
script.Parent.Gas.Value = 100
script.Parent.ProximityPrompt.Enabled = true
script.Parent.ProximityPrompt.Script.Enabled = true
end
end
script to refill