Ad
Log in to vote
0

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

Asked by 7 years ago

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

Log in to vote
0
Answered by 7 years ago

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.

Ad

Answer this question