Back to Scripts
Clock Gui

Clock Gui

ScriptBlox
Free

Game: πŸ”±ERAπŸ”± De Pride Isle Sanatorium

130 Views
1 Likes
0 Dislikes
beach99

beach99

offline

Features

See Game Military Time and Standard Time And For PC Click L

Script Code

local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local TweenService = game:GetService("TweenService")
local UserInputService = game:GetService("UserInputService")
local Lighting = game:GetService("Lighting")

local player = Players.LocalPlayer
local pGui = player:WaitForChild("PlayerGui")

-- 1. CREATE UI
local screenGui = Instance.new("ScreenGui")
screenGui.Name = "GameClockSystem"
screenGui.ResetOnSpawn = false
screenGui.Parent = pGui

-- Toggle Button
local openBtn = Instance.new("TextButton")
openBtn.Size = UDim2.new(0, 160, 0, 45)
openBtn.Position = UDim2.new(0, 20, 0.8, -50)
openBtn.Text = "CLOCK MENU (L)"
openBtn.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
openBtn.TextColor3 = Color3.new(1, 1, 1)
openBtn.Font = Enum.Font.GothamBold
openBtn.Parent = screenGui

local btnCorner = Instance.new("UICorner")
btnCorner.CornerRadius = UDim.new(0, 8)
btnCorner.Parent = openBtn

-- Main Menu Frame
local menuFrame = Instance.new("Frame")
menuFrame.Size = UDim2.new(0, 300, 0, 180) 
menuFrame.Position = UDim2.new(0.5, -150, 0.5, -90)
menuFrame.BackgroundColor3 = Color3.fromRGB(10, 10, 10)
menuFrame.BackgroundTransparency = 1 
menuFrame.Visible = false
menuFrame.Parent = screenGui

local uiCorner = Instance.new("UICorner")
uiCorner.CornerRadius = UDim.new(0, 15)
uiCorner.Parent = menuFrame

local uiStroke = Instance.new("UIStroke")
uiStroke.Thickness = 2
uiStroke.Color = Color3.fromRGB(0, 170, 255)
uiStroke.Parent = menuFrame

-- Title Label
local titleLabel = Instance.new("TextLabel")
titleLabel.Size = UDim2.new(1, 0, 0, 40)
titleLabel.Position = UDim2.new(0, 0, 0, 10)
titleLabel.BackgroundTransparency = 1
titleLabel.Text = "β€” SERVER TIME β€”"
titleLabel.TextColor3 = Color3.fromRGB(0, 170, 255)
titleLabel.TextSize = 14
titleLabel.Font = Enum.Font.GothamBold
titleLabel.TextTransparency = 1
titleLabel.Parent = menuFrame

-- STANDARD TIME LABEL (White)
local stdLabel = Instance.new("TextLabel")
stdLabel.Size = UDim2.new(1, 0, 0, 50)
stdLabel.Position = UDim2.new(0, 0, 0, 50) -- Positioned below title
stdLabel.BackgroundTransparency = 1
stdLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
stdLabel.TextSize = 35
stdLabel.Font = Enum.Font.GothamBold
stdLabel.TextTransparency = 1
stdLabel.Parent = menuFrame

-- MILITARY TIME LABEL (Neon Green - CANNOT MISS THIS)
local milLabel = Instance.new("TextLabel")
milLabel.Size = UDim2.new(1, 0, 0, 40)
milLabel.Position = UDim2.new(0, 0, 0, 105) -- Positioned specifically below Standard
milLabel.BackgroundTransparency = 1
milLabel.TextColor3 = Color3.fromRGB(0, 255, 120) -- Neon Green
milLabel.TextSize = 25
milLabel.Font = Enum.Font.Code
milLabel.TextTransparency = 1
milLabel.Parent = menuFrame

--- 2. TIME LOGIC ---
local function updateClocks()
	local clockTime = Lighting.ClockTime
	local totalMinutes = clockTime * 60
	local hours = math.floor(totalMinutes / 60)
	local minutes = math.floor(totalMinutes % 60)
	
	-- Standard
	local ampm = hours >= 12 and "PM" or "AM"
	local h12 = hours % 12
	if h12 == 0 then h12 = 12 end
	stdLabel.Text = string.format("%02d:%02d %s", h12, minutes, ampm)
	
	-- Military
	milLabel.Text = string.format("%02d:%02d MIL", hours, minutes)
end

--- 3. TOGGLE ---
local isOpen = false
local tInfo = TweenInfo.new(0.3, Enum.EasingStyle.Quart, Enum.EasingDirection.Out)

local function toggle()
	isOpen = not isOpen
	if isOpen then menuFrame.Visible = true end
	
	local targetAlpha = isOpen and 0 or 1
	local bgAlpha = isOpen and 0.1 or 1
	
	TweenService:Create(menuFrame, tInfo, {BackgroundTransparency = bgAlpha}):Play()
	TweenService:Create(titleLabel, tInfo, {TextTransparency = targetAlpha}):Play()
	TweenService:Create(stdLabel, tInfo, {TextTransparency = targetAlpha}):Play()
	TweenService:Create(milLabel, tInfo, {TextTransparency = targetAlpha}):Play()
	
	if not isOpen then
		task.delay(0.3, function()
			if not isOpen then menuFrame.Visible = false end
		end)
	end
end

openBtn.MouseButton1Click:Connect(toggle)
UserInputService.InputBegan:Connect(function(io, gpe)
	if not gpe and io.KeyCode == Enum.KeyCode.L then toggle() end
end)

RunService.RenderStepped:Connect(updateClocks)

--- 4. DRAG ---
local dragging, dragInput, dragStart, startPos
menuFrame.InputBegan:Connect(function(input)
	if input.UserInputType == Enum.UserInputType.MouseButton1 then
		dragging = true
		dragStart = input.Position
		startPos = menuFrame.Position
	end
end)
UserInputService.InputChanged:Connect(function(input)
	if dragging and input.UserInputType == Enum.UserInputType.MouseMovement then
		local delta = input.Position - dragStart
		menuFrame.Position = UDim2.new(startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, startPos.Y.Offset + delta.Y)
	end
end)
UserInputService.InputEnded:Connect(function(input)
	if input.UserInputType == Enum.UserInputType.MouseButton1 then dragging = false end
end)

Ratings & Reviews

No reviews yet. Be the first to review this script!

Comments (0)

Please login to comment

Login with Discord

Loading comments...