Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How to make a part go neon when it turns night time?

Asked by 3 years ago

This is currently my day/night system script:

local dayLength = 10

local cycleTime = dayLength*60
local minutesInADay = 24*60

local lighting = game:GetService("Lighting")

local startTime = tick() - (lighting:getMinutesAfterMidnight() / minutesInADay)*cycleTime
local endTime = startTime + cycleTime

local timeRatio = minutesInADay / cycleTime

if dayLength == 0 then
    dayLength = 1
end

repeat
    local currentTime = tick()

    if currentTime > endTime then
        startTime = endTime
        endTime = startTime + cycleTime
    end

    lighting:setMinutesAfterMidnight((currentTime - startTime)*timeRatio)
    wait(1/15)
until false

And I'd like to make my part turn neon when it turns night time, can anybody please help me?

1 answer

Log in to vote
1
Answered by 3 years ago

im thinking of making another script under the part

game.Lighting.Changed:Connect(function()
    if game.Lighting.ClockTime >18 and game.Lighting.ClockTime < 7 then
        script.Parent.Material = Enum.Material.Neon
    end
end)

if the times between 18-6 isn't nighttime u can change it

0
It works :D Thanks so much Buzzettego 5 — 3y
0
yw fullguyblox3 69 — 3y
Ad

Answer this question