Can someone help me edit this script to change to Neon when it reaches a certain time, but changes back to SmoothPlastic when it reaches another certain time?
local Lighting = game:GetService("Lighting"); -- Our while loop while true do -- Checking if the time is 18 or more. if Lighting.ClockTime >= 18 then -- Let's change the lamp's material to Neon! script.Parent.BrickColor = BrickColor.new("Pink") else -- Change it to SmoothPlastic if it isn't late :D script.Parent.Material = Enum.Material.SmoothPlastic; end wait(1) -- Waits a second before continuing end
Instead of using a while loop, connect to :GetPropertyChangedSignal()
or LightingChanged
.
local lighting = game:GetService("Lighting") lighting:GetPropertyChangedSignal("TimeOfDay"):Connect(function() -- your code here end)
To change a part's material to neon, you do it in thes same way that you did for SmoothPlastic, but replacing it with Neon
part.Material = Enum.Material.Neon
Documentation on GetPropertyChangedSignal, Materials
pink isnt a material, its a colour.
local Lighting = game:GetService("Lighting"); while true do if Lighting.ClockTime >= 18 then script.Parent.Material = Enum.material.Neon script.Parent.BrickColor = BrickColor.new("Pink") else script.Parent.Material = Enum.Material.SmoothPlastic; end wait(1) end