Advertisement
ExamV1

Roblox Realtime Clock

Feb 8th, 2023
1,006
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.38 KB | None | 0 0
  1. --Realtime clock that will appear at the top of your screen in 12 hour format, with a rainbow colour border
  2.  
  3. local player = game:GetService("Players").LocalPlayer
  4.  
  5. local function makeGui()
  6.   local gui = Instance.new("ScreenGui")
  7.   local textLabel = Instance.new("TextLabel")
  8.   local frame = Instance.new("Frame")
  9.  
  10.   gui.Name = "TimeDisplay"
  11.   frame.Name = "Background"
  12.   frame.Parent = gui
  13.   frame.BackgroundColor3 = Color3.new(0.2, 0.2, 0.2)
  14.   frame.Position = UDim2.new(0.5, 0, 0, 0)
  15.   frame.Size = UDim2.new(0, 150, 0, 50)
  16.   frame.AnchorPoint = Vector2.new(0.5, 0)
  17.  
  18.   textLabel.Name = "Time"
  19.   textLabel.Parent = frame
  20.   textLabel.Text = tostring(os.date("%I:%M:%S %p"))
  21.   textLabel.Position = UDim2.new(0.5, 0, 0.5, 0)
  22.   textLabel.Size = UDim2.new(0, 100, 0, 50)
  23.   textLabel.TextScaled = true
  24.   textLabel.TextWrapped = true
  25.   textLabel.TextColor3 = Color3.new(1, 1, 1)
  26.   textLabel.BackgroundTransparency = 1
  27.   textLabel.AnchorPoint = Vector2.new(0.5, 0.5)
  28.  
  29.   gui.Parent = player:WaitForChild("PlayerGui")
  30.  
  31.   local hue = 0
  32.   while true do
  33.     wait(0.01)
  34.     hue = hue + 0.01
  35.     if hue >= 1 then
  36.       hue = 0
  37.     end
  38.     frame.BorderColor3 = Color3.fromHSV(hue, 1, 1)
  39.     textLabel.Text = tostring(os.date("%I:%M:%S %p"))
  40.   end
  41. end
  42.  
  43. while true do
  44.   if not player:FindFirstChild("PlayerGui"):FindFirstChild("TimeDisplay") then
  45.     makeGui()
  46.   end
  47.   wait(1)
  48. end
  49.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement