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

How to make turn on PointLight at night in torso of player and turn off when it's day?

I tried to make this LocalScript at StarterCharacterScripts but it's not working..

local PointLight = Instance.new("PointLight", script.Parent.Torso)
PointLight.Enabled = false
PointLight.Range = 50
PointLight.Brightness = 2
PointLight.Shadows = true

if game.Lighting.ClockTime >= 22 then
	PointLight.Enabled = true
else
	if game.Lighting.ClockTime >= 8 then
		PointLight.Enabled = false
	end
end

1 answer

✓ Accepted answer

Put it in a loop so that the script will constantly check the time.

while true do
	if game.Lighting.ClockTime >= 22 then
		PointLight.Enabled = true
	elseif game.Lighting.ClockTime >= 8 then
		PointLight.Enabled = false
	end
	task.wait()
end

1 comment

0

Thank you very much! It's actually works!

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