Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Trying to create a script where it times how long a lamp as been on for but it doesn't work. Fix?

Asked by 3 years ago
Edited 3 years ago
switch = game.Workspace.Lamp.Union.PointLight

timer = 0

while switch.Enabled == true do
    wait(1)
    timer = timer + 1
    print(timer)
    if timer == 10 then
        print("is ten")
    end
end

Kinda new 2 scripting, sorry.

0
what isn't working k3du53 162 — 3y
0
it won't print anything productofdevs 1 — 3y

1 answer

Log in to vote
0
Answered by 3 years ago

this is a local script which is located in StarterGui

local PointLight = game.Workspace.Lamp.Union.PointLight
local battery = 60
local lamp = game.Workspace.Lamp.Union

while true do
    wait()
    if PointLight.Enabled == true then
        battery = battery - 1
        print(battery)
        wait(1)
    end
end

Simple solution.

Ad

Answer this question