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

Can someone explain to me how to edit this script to make it Darker?

it does run, but day is to bright and night is not dark enough

local timer = game.Lighting
local delay = script.Delay

repeat
	timer:SetMinutesAfterMidnight(timer:GetMinutesAfterMidnight()+1)
	x = timer:GetMinutesAfterMidnight()
	if x < 720 then
		light = x*17/(255*48)
	else
		light = (1440*17)/(255*48)-(x*17)/(255*48)
	end
	timer.Brightness = light
	if x > (1440 - script.LightLimit.Value) then
	local lightLimit = (1440*17)/(255*48)-(1260*17)/(255*48)
	timer.OutdoorAmbient = Color3.new(lightLimit,lightLimit,lightLimit)
	print(lightLimit)
	elseif x < script.LightLimit.Value then
	local lightLimit = 180*17/(255*48)
	timer.OutdoorAmbient = Color3.new(lightLimit,lightLimit,lightLimit)
	print(lightLimit)
	else
	timer.OutdoorAmbient = Color3.new(light,light,light)
	print(light)
	end
	print(timer:GetMinutesAfterMidnight())
	if delay.Value==0 or delay.Value<0 then
		wait(1)
	else
		wait(delay.Value)
	end
until 1==0

1 answer

✓ Accepted answer

Running math on a string (which is what game.Lighting.TimeOfDay is) will throw an error, specifically "-script- attempted to run math on a string." I believe that is your problem.

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