Need help with that firework lights up at only night time!

Hello,

How do I make a firework that lights up at only night
I need help!

1 Like

Here is the script, if you don’t understand tell me.

local Lighting = game:GetService("Lighting") -- HERE LIGHTING WE CONTROL WEATHER AND DAY/NIGHT
local Folder = game.Workspace["Folder"] -- THIS IS THE FOLDER OF FIREWORKS I ASSUMED THAT NAME IS FOLDER AND IT IS FOLDER YOU CAN CHANGE IT

local function NeonOrNot(Debounce) -- THIS SCRIPT IS FOR MAKE ALL OF FIREWORKS NEON OR LIGHTS UP
	
	for i,v in pairs(Folder:GetChildren()) do -- THIS GETS ALL OF FIREWORKS
		
		if Debounce == false then --IF FALSE(NIGHT) THEN IT MAKES LIGHT UP
			
			v.Material = Enum.Material.Neon
			-- YOU CAN CHANGE HERE BY IF YOU WANT TO MAKE DIFFERENT LIGHT UP
			
		else -- IF ITS NOT 
			
			v.Material = Enum.Material.SmoothPlastic
			-- YOU CAN CHANGE HERE BY IF YOU WANT TO MAKE DIFFERENT LIGHT DOWN
		end
	end
end

Lighting:GetPropertyChangedSignal("ClockTime"):Connect(function() --IF THE TIME HAS CHANGED
	local ClockTime = Lighting.ClockTime -- THE TIME
	
	if ClockTime >= 17.7 or ClockTime >= 0 and ClockTime <= 6.7 then -- IF NIGHT
		NeonOrNot(false) -- WE ARE CALLING FUNCTION THAT MAKES LIGHT UP OR DOWN (ASSUMING NIGHT)
		--if Sunset and night
	elseif ClockTime < 18 or ClockTime > 7 then -- if not
		NeonOrNot(true) -- WE ARE CALLING FUNCTION THAT MAKES LIGHT UP OR DOWN (ASSUMING DAY)
		-- If sunrise and day
	end
end)

4 Likes

Hello,

What part do i need to place this in?

1 Like

Judging by the script, you can put it anywhere. Because you call the folder containing all the fireworks, meaning if it were to be “script.Parent” then you would prerequisite to place it inside the firework

3 Likes

Although some directories such as ReplicatedStorage might not work in this case for the script.

3 Likes