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

What is my error? Why isn't the light turning on?

local lightPart = script.Parent
local pointLight = lightPart.PointLight

while true do
	wait(0.01)
	if game.Lighting:GetMinutesAfterMidnight() > 6 * 60 then
		lightPart.Material = Enum.Material.Plastic
		pointLight.Enabled = false
	end
	if game.Lighting:GetMinutesAfterMidnight() < 18 * 60 then
		lightPart.Material = Enum.Material.Neon
		pointLight.Enabled = true
	end
end

1 answer

You watched the ROBLOX tutorial didnt you? Go and rewatch it because you didnt get the script right. Thats the script:

local lightPart = script.Parent
local pointLight = lightPart.PointLight

while true do
    wait(0.01)
    if game.Lighting:GetMinutesAfterMidnight() > 6 * 60 then
        lightPart.Material = Enum.Material.Plastic
        pointLight.Enabled = false
    end
    if game.Lighting:GetMinutesAfterMidnight() > 18 * 60 then
        lightPart.Material = Enum.Material.Neon
        pointLight.Enabled = true
    end
end

2 comments

0

Could you point out the difference in your code?

0

^ Notice how the “<“ on line 10 changed to a “>”. I’ll admit though that the person should point it out as new scripters can easily miss it.

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