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 4 years ago
Edited 4 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 — 4y
0
it won't print anything productofdevs 1 — 4y

1 answer

Log in to vote
0
Answered by 4 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