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

How do I enable a PointLight based on the Time of Day in game? [SOLVED]

In detail, I want to enable a PointLight I inserted into a Part based on what the time it is in the game. My goal is to have PointLights around my place enabled throughout the time of night in the game. Can someone please help me, I'm very rusty and I know this is a simple task. All help is appreciated.

pLight = game.Workspace.Light.PointLight
ToD = game.Lighting.ClockTime

if ToD == 13 then
    pLight.Enabled = true
end

2 comments

0

Thanks, it worked! Upvoted

1 answer

✓ Accepted answer
pLight = game.Workspace.Light.PointLight
ToD = game.Lighting.ClockTime

if ToD == 13 then
    pLight.Enabled = true
end

that will only run once

do

local time = game.Lighting.ClockTime
time.Changed:connect(function(OMGGG)
	if ToD == 13 then
	pLight.Enabled = true
	end
end)

this script runs the if statement when ClockTime is changed

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