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

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

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

✓ Accepted answer

try adding

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

2 comments

0

if game.Lighting.TimeOfDay == "00:00:00" then game.Workspace.Part2.Material = "Neon" end my bad

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

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