Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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.

2 comments

0

what isn't working

0

it won't print anything

1 answer

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.

This discussion is preserved as it was. New answers, comments, and votes are closed.