Text UI pop at (in-game) (12AM) script

Hello, Developers.

I am new to a script (coding) and I wanted to make a text gui that sends a text message in (in-game) time at exact (12AM)! I need help asap on this script!
Here is a example that I’m talking about when the (in-game) time hits 9:55 the text will pop up by saying “Show will start in 5 Minutes”!

Here is a picture of the idea that I’m talking about!

2 Likes

when you say that you want the text to appear at 12 AM do you mean 12 AM in real life?

2 Likes

Yes I want the text to appear at In game 12AM.

1 Like

can you send the script for the clock and the explorer

2 Likes

Picture of the Clock GUI - image
Picture of the Script -

1 Like

is this in a localscript or a script

2 Likes

It is a local script
image

2 Likes

explorer:

image

localscript:

local player = game:GetService("Players").LocalPlayer
local notifgui = player.PlayerGui:WaitForChild("Notification")

function getLightingTime()
	local totalMinutes = game.Lighting:GetMinutesAfterMidnight()
	local hours = math.floor(totalMinutes / 60)
	local minutes = math.floor(totalMinutes % 60)
	local period
	if hours < 12 then
		period = "AM"
	else
		period = "PM"
		hours -= 12
	end
	if hours == 0 then
		hours = 12
	end
	if hours == 12 and period == "AM" then
		--Midnight
		notifgui.Enabled = true
		task.wait(5)
		notifgui.Enabled = false
	end
	return string.format("%02d:%02d %s", hours, minutes, period)
end

print(getLightingTime())
2 Likes

MidnightNotification is just a textlabel that says “it’s midnight” or something, and the Enabled property on ScreenGuis determines whether or not it’s visible

1 Like
game.Lighting:GetPropertyChangedSignal("ClockTime"):Connect(function()
    Gui.Text = getLightingTime()

    if game.Lighting.ClockTime == 12 then
        --Code to put the frame visible
        YourGuiFrame.Visible = true
    end

    --You can also use this for more precision
    --Choose only one of both (ClockTime or TimeOfDay) and delete the other
    if game.Lighting.TimeOfDay == "12:00:00" then
	YourGuiFrame.Visible = true
    end
end
2 Likes

My clock text doesn’t work for some reason?
image

1 Like

i’m guessing that the problem is that the clock is just stuck at 00:00. are you updating PlayerGui or StarterGui?

1 Like

This is what I did and I put the script on the LocalScript!
image

2 Likes

Do I change any thing from here?

2 Likes

i’m working on it, hang on… character limit

2 Likes

Did you tried my code ???

1 Like

Sorry not yet let me try right now On what line do I put them on?
image

1 Like

sorry gtg character limit sorry

2 Likes

It is instead of the while true do, and make sure to change the YourGuiFrame thing to your actual frame you want to show off when the wanted time is reached

1 Like

Is it Like this? and It didn’t work!
I want the Text Ui to pop up at 9:55 PM

1 Like