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

Why is my light not working?

I am trying to make a light for a light pole turn on at 6PM (18 * 60) ingame and off at 6AM (6 * 60) ingame, but it tells me there is a function argument expected on line 8, with red wavy lines under the double equal sign.

What am I doing wrong?

LightPolelight = game.Workspace.LightPoleLight minutesAfterMidnight = 0 while true do minutesAfterMidnight = minutesAfterMidnight + 10 game.Lighting:SetMinutesAfterMidnight(minutesAfterMidnight) wait(.1)

if game.Lighting:GetMinutesAfterMidnight == 6*10 then
	LightPolelight.Material = Enum.Material.Plastic
	LightPolelight.PointLight.Enabled = false
end
if game.Lighting:GetMinutesAfterMidnight == 18*60 then
	LightPolelight.Material = Enum.Material.Neon
	LightPolelight.PointLight.Enabled = true
end

end

OUTPUT: 12:08:25.568 - Workspace.Script:8: function arguments expected near '=='

3 comments

0

It messed the first part of the script up...

0

You can edit it and fix by clicking 'Edit'. Anyhow, ":GetMinutesAfterMidnight" should be ":GetMinutesAfterMidnight()".

0

Now when I run the script, the pointer light does not turn off when 6AM reaches. Does anyone know the problem?

1 answer

Thanks to Pyrondon for the answer but rewriting code.

if game.Lighting:GetMinutesAfterMidnight() == 6*10 then --Missed "()" 
    LightPolelight.Material = Enum.Material.Plastic
    LightPolelight.PointLight.Enabled = false
end
if game.Lighting:GetMinutesAfterMidnight() == 18*60 then --Missed "()" 
    LightPolelight.Material = Enum.Material.Neon
    LightPolelight.PointLight.Enabled = true
end

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