Try to make ingame weekdays in time gui like Mon 12:00 PM

Screenshot (8)
hi everybody im trying to make a Ingame weekday in time with gui in when every gametime hit 0 Mon - Sun in this the script

local lighting = game:GetService("Lighting")
local replicatedStorage = game:GetService("ReplicatedStorage")
local event = replicatedStorage:findFirstChild("ChangeTime")

while wait(1) do
	local hours = math.floor(lighting:GetMinutesAfterMidnight() / 60)
	local suffix = "AM"
	local days = "Sun" 
	local minutes = lighting:GetMinutesAfterMidnight() - (hours * 60)
	if hours > 11 then
		hours = hours - 12
		suffix = "PM"
	end

	if hours == 0 then
		hours = 12
	end

	if minutes < 10 then
		minutes = "0" .. minutes
	end

	local text = days .. " " ..  hours .. ":" .. minutes .. " " .. suffix
	event:FireAllClients(text)
	lighting:SetMinutesAfterMidnight(lighting:GetMinutesAfterMidnight() + 1)

end

2 Likes

what have you tried? do you have any problems?

Try to get the weekday with the time ingame

yeah but what have you tried in the script? have you gotten any errors? we can’t usually just give you a script lol

1 Like

Yes i have an error with the script

1 Like

can you please show us it in the post? you didn’t give any information at all…

I update the information to show the script

Pretty sure this doesn’t correlate to real life time, I think it’s just the ingame time set with TimeOfDay. Look into DateTime instead.

The Days could be a string value

Use the game’s clock to change the day every time it reaches a certain point in lighting by changing a number value maybe? After it reaches a certain value you can set it back maybe.

Maybe something like this? To detect the value being over 7 days.

script.Parent:GetPropertyChangedSignal("Value"):Connect(function()
	if script.Parent.Value <= 8 then
		script.Parent.Value = 1
	end
end)

The day can then be changed to whatever you like from there. This is how I would do it.

Is there a way to get it to show Monday to Sunday

i figured you’d know that considering the script you made srry

You can use the number value to change the time. Maybe something like this.

local DayValue = --wherever it shall be

if DayValue.Value == 1 then
	script.Parent.Text = "Mon"
end

It showed the weekday Mon - Sun

we’re not supposed to write the script for you. You can finish the rest of the script on your own. I don’t think the task is all that difficult.

Days = {"Mon",  "Tue",  "Wed",  "Thu", "Fri", "Sat", "Sun"}

If you really wanted to use an array that could work, but it’s not required. You can check each number after checking the value of the day.

this isn’t the best way probably but I’m not the best scripter

Thanks for the all the feedback

if it works can you please mark me as the solution?

Use the array of days then just get the day with Days[day]

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.