Gui not popping up again?

Hello! I made a script where it detects if it’s night, it’ll trigger a remote event which makes the gui visible. it works the first time, but on the 2nd night, it dosen’t pop up. Any help is appreciated!

local RepStorage = game:GetService("ReplicatedStorage")
local NightEvent = RepStorage:WaitForChild("NightEvent")
local prompt = game.Workspace.Sled2.SledPrompt.ProximityPrompt
local ClearEvent = RepStorage:WaitForChild("ClearEvent")

game.Lighting.ClockTime = 14

while true do
	minutesAfterMidnight = minutesAfterMidnight + .2 -- .2
	if game.Lighting:GetMinutesAfterMidnight() == 6 * 60 then		-- checks for 6AM
		if prompt.Enabled == true then
			prompt.Enabled = false
	if game.Lighting:GetMinutesAfterMidnight() == 18.38 * 60 then		-- checks for 6PM
		if prompt.Enabled == false then
			prompt.Enabled = true

It would be useful to see the LocalScript handling the remote events, furthermore, have you tried print debugging your scripts and checked which script is the cause of the issue? Might be down to one particular statement or the handling of events.

Well, a local script does handle the remote events, I’ll try using print commands.

I’d also recommend adding prints for the variables sent from the server on the LocalScript, this ensures that you can check for differences on the variables from the 1st and 2nd nights.

Heres the Night event local script:

local gui = script.Parent
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local NightEvent = ReplicatedStorage:WaitForChild("NightEvent")

	gui.Visible = true

I’m presuming ‘gui’ is already defined under a variable. My suggestion would be to print the variable “minutesAfterMidnight” in the second if statement and compare the values of it on both nights.

I formatted the code incorrectly, hold on.