Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --TimeSensor--
- TurnOn = 19
- TurnOff = 7
- On = false
- while wait(10) do
- if game.Lighting.ClockTime >= TurnOn then
- if not On then
- On = true
- script.Parent.Flicker.On.Value = true
- end
- elseif game.Lighting.ClockTime >= TurnOff then
- if On then
- On = false
- script.Parent.Flicker.On.Value = false
- end
- end
- end
- --Flickering--
- -- Anything parented to this script's parent will be lit up!
- MaxFlickerWait = 30
- MinFlickerWait = 10
- Allow = false
- function Change(Mode)
- for _,i in pairs (script.Parent:GetChildren()) do
- if i:IsA("BasePart") then
- if Mode then
- i.Material = "Neon"
- else
- i.Material = "SmoothPlastic"
- end
- elseif i:IsA("Model") then
- for _,i in pairs (i:GetChildren()) do
- if Mode then
- i.Material = "Neon"
- else
- i.Material = "SmoothPlastic"
- end
- end
- end
- end
- end
- script.On.Changed:connect(function()
- if script.On.Value then
- Allow = true
- Change(true)
- else
- Allow = false
- Change(false)
- end
- end)
- while wait(math.random(MinFlickerWait,MaxFlickerWait)) do
- if Allow then
- local function Check() if not Allow then return end end
- local WaitTime = .5
- Change(false)
- wait(WaitTime/2); Check();
- Change(true)
- wait(WaitTime); Check()
- Change(false)
- wait(WaitTime*1.5); Check()
- Change(true)
- wait(WaitTime); Check()
- Change(false)
- wait(WaitTime/5); Check()
- Change(true)
- wait(WaitTime); Check()
- Change(false)
- wait(WaitTime/8); Check()
- Change(true)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement