https://youtu.be/lvcwAlR_d1A
ローカルスクリプトに書いてください。
local clock = game.Workspace["12clock"]:WaitForChild("DClock")
local mojiban = clock:WaitForChild("clockmojiban")
local gozengogo = mojiban:WaitForChild("GG")
local times = mojiban:WaitForChild("time")
local minutes = mojiban:WaitForChild("min")
local seconds = mojiban:WaitForChild("sec")
local monthp = mojiban:WaitForChild("month")
local dayp = mojiban:WaitForChild("day")
local youbip = mojiban:WaitForChild("yobi")
while true do
local date1 = DateTime.now()
--午前午後を判断
local AMorPM = date1:FormatLocalTime("A","en-us")
--print("午後か午前か…今は"..date:FormatLocalTime("A","en-us"))
if AMorPM == "AM" then
gozengogo.SurfaceGui.TextLabel.Text = "午前"
else
gozengogo.SurfaceGui.TextLabel.Text = "午後"
end
--時間
local time1 = date1:FormatLocalTime("hh","en-us")
times.SurfaceGui.TextLabel.Text = time1
--分
local minute = date1:FormatLocalTime("mm","en-us")
mojiban.min.SurfaceGui.TextLabel.Text = minute
--秒
local sec = date1:FormatLocalTime("ss","en-us")
seconds.SurfaceGui.TextLabel.Text = sec
--月
local mon = date1:FormatLocalTime("M","en-us")
monthp.SurfaceGui.TextLabel.Text = mon
--日
local day = date1:FormatLocalTime("D","en-us")
dayp.SurfaceGui.TextLabel.Text = day
--曜日
local yobi = date1:FormatLocalTime("dd","en-us")
local yobilabel = youbip.SurfaceGui.TextLabel
if yobi == "Su" then
yobilabel.Text = "日"
elseif yobi == "Mo" then
yobilabel.Text = "月"
elseif yobi == "Tu" then
yobilabel.Text = "火"
elseif yobi == "We" then
yobilabel.Text = "水"
elseif yobi == "Th" then
yobilabel.Text = "木"
elseif yobi == "Fr" then
yobilabel.Text = "金"
else
yobilabel.Text = "土"
end
task.wait(0.1)
end
時間や日付などを表示させるための記号は↓のページ内にある「元素トークン」一覧を確認してください。様々な形で表示することができます。
https://create.roblox.com/docs/ja-jp/reference/engine/datatypes/DateTime