forked from Epix-Incorporated/Adonis
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCountdown.luau
More file actions
113 lines (95 loc) · 2.25 KB
/
Copy pathCountdown.luau
File metadata and controls
113 lines (95 loc) · 2.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
client = nil
service = nil
return function(data, env)
if env then
setfenv(1, env)
end
local gTable
local tLimit = data.Time
local sImg
local isMuted = false
local tock = service.New('Sound')
tock.Volume = 0.25
tock.Looped = false
tock.SoundId = 'http://www.roblox.com/asset/?id=151715959'
local buzzer = service.New('Sound')
buzzer.Volume = 0.25
buzzer.Looped = false
buzzer.SoundId = 'http://www.roblox.com/asset/?id=267883066'
local textSize = service.TextService:GetTextSize(tLimit, 100, Enum.Font.SourceSans, Vector2.new(math.huge,math.huge))
if textSize.X < 150 then textSize = Vector2.new(175, textSize.Y) end
local window = client.UI.Make("Window", {
Name = "Countdown";
Title = "Countdown";
Size = {textSize.X + 20, textSize.Y + 20};
Position = UDim2.new(0, 10, 1, -(textSize.Y + 30));
OnClose = function()
tock:Stop()
buzzer:Stop()
tock:Destroy()
buzzer:Destroy()
end
})
local label = window:Add("TextLabel", {
Text = tLimit;
BackgroundTransparency = 1;
TextScaled = true;
})
local muteButton = window:AddTitleButton({
Text = "";
OnClick = function()
if isMuted then
tock.Volume = 0.25
buzzer.Volume = 0.25
sImg.Image = "rbxassetid://7463478056"
isMuted = false
else
tock.Volume = 0
buzzer.Volume = 0
sImg.Image = "rbxassetid://7463462018";
isMuted = true
end
end
})
sImg = muteButton:Add("ImageLabel", {
Size = UDim2.new(1, 0 ,0.85, 0);
AnchorPoint = Vector2.new(0.5,0.5);
ScaleType = Enum.ScaleType.Fit;
Position = UDim2.new(0.5, 0 ,0.536, 0);
Image = "rbxassetid://7463478056";
BackgroundTransparency = 1;
})
tock.Parent = label
buzzer.Parent = label
gTable = window.gTable
gTable:Ready()
local startTime = os.clock()
local expectedDelay = 0
local waitTime = 1
local timeOff = 0
for i = tLimit, 1, -1 do
if gTable.Active then
tock:Play()
label.Text = i
else
break
end
task.wait(waitTime - timeOff)
expectedDelay += waitTime
timeOff = os.clock() - startTime - expectedDelay
end
label.Text = "0"
buzzer:Play()
for k = 0,3 do
buzzer:Play()
for i = 1, 0, -0.1 do
label.TextTransparency = i
task.wait(0.05)
end
for i = 0, 1, 0.1 do
label.TextTransparency = i
task.wait(0.05)
end
end
window:Close()
end