I have a script that I've been using to have SpotLight's enabled at a certain time, but I'm not sure how to make it so the parts inside of a model/the parent's material changes to Neon, then back to Plastic?

b = script.Parent

local oh,om = 6,10	-- Open Time (hours,minutes)
local ch,cm = 17,30	-- 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)

4 comments

0

i dont rlly understand, do u mean like if the server has been on for 5hrs after 5hrs it changes? or like after 10 seconds that u joun da game? or when u click something?

0

nvm its time of day, i never tried that so i cant help srry :(

0

I just need the parts listed to make a brick inside of a Parent change materials, forget about the time parts.

0

Anyone?