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

How Do I Make A Material Change Its Appearance From Smooth Plastic To Neon On A Certain Of Time?

Asked by
ImfaoXD 158
8 years ago

What I'm trying to do is I want the material to change its appearance from smooth plastic to neon when it is turn to night time. How can I do that? I don't know how to fix it and I need you guys to help me out.

--This script turns the light on at night and off in in the day!

b = script.Parent

local oh,om = 6,20  -- Open Time (hours,minutes)
local ch,cm = 17,45 -- Close Time (hours, minutes)

local l = game:service("Lighting")
if (om == nil) then om = 0 end
if (cm == nil) then cm = 0 end


function TimeChanged()
    local ot = (oh + (om/60)) * 60
    local ct = (ch + (cm/60)) * 60
    if (ot < ct) then
        if (l:GetMinutesAfterMidnight() >= ot) and (l:GetMinutesAfterMidnight() <= ct) then
b.Enabled = false
        else
b.Enabled = true
        end
    elseif (ot > ct) then
        if (l:GetMinutesAfterMidnight() >= ot) or (l:GetMinutesAfterMidnight() <= ct) then
b.Enabled = false
        else
b.Enabled = true
        end
    end
end

TimeChanged()
game.Lighting.Changed:connect(function(property)
            if (property == "TimeOfDay") then
                TimeChanged()
            end
        end)

Many thanks, my friends!

1 answer

Log in to vote
0
Answered by 8 years ago

try adding

if game.Lighting.TimeOfDay == 000000 then game.Workspace.Part2.Material = "Neon" end

0
if game.Lighting.TimeOfDay == "00:00:00" then game.Workspace.Part2.Material = "Neon" end my bad OoCarrahlaxoO 5 — 8y
1
Yeah this person gives us a script unrelated to changing a part to neon, which really isn't relevant to the question asked, lmao Maxwell_Edison 105 — 8y
Ad

Answer this question