--12 hours : 360 degs
--1 hour : 30 degs
--60 mins : 30 degs
--1 min : 0.5 degs
--60 s : 0.5 degs
--1 s : 0.00833333333... degs


local chour, chmin, chsec = 0,0,0
local centerPoint = script.Parent.CenterPoint

local function TryUpdateHour(h, m, s)
	if chour ~= h or chmin ~= m or chsec ~= s then
		chour = h
		chmin = m
		chsec = s
		return true	
	end
	return false
end

local function PlayBell()
	centerPoint.Bell:Play()
	centerPoint.BillboardGui.Enabled = true
	delay(11.2*3, function ()
		centerPoint.Bell:Stop()
		centerPoint.BillboardGui.Enabled = false
	end)
end

local function UpdatePointers()
	local hourhinge = centerPoint.HoursHinge
	local secshinge = centerPoint.SecsHinge
	local minshinge = centerPoint.MinsHinge
	secshinge.TargetAngle = chsec * 6
	minshinge.TargetAngle = chmin * 6
	hourhinge.TargetAngle = chour * 30

	if (chour == 12 or chour == 0) and (chmin == 0 and chsec == 0) then
		PlayBell()
	end
end

while wait()
do
	local now = os.time()
	local hours = os.date("*t",now)["hour"]
	local mins = os.date("*t",now)["min"]
	local secs = os.date("*t",now)["sec"]
	if TryUpdateHour(hours, mins, secs) then