forked from Epix-Incorporated/Adonis
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSelectionPrompt.luau
More file actions
64 lines (52 loc) · 1.24 KB
/
SelectionPrompt.luau
File metadata and controls
64 lines (52 loc) · 1.24 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
client, service = nil, nil
return function(data, env)
if env then
setfenv(1, env)
end
local gTable
local answer
local done = false;
local options = data.Options;
local name = data.Name;
local window = client.UI.Make("Window",{
Name = name or "SelectionPrompt";
Title = name or "Selection Prompt";
Icon = client.MatIcons["Format list bulleted"];
Size = {225,150};
SizeLocked = true;
OnClose = function()
if not answer then
answer = nil
end
done = true;
end
})
local frame = window:Add("ScrollingFrame", {
Size = UDim2.new(1, 0, 1, 0);
Position = UDim2.new(0, 0, 0, 0);
BackgroundTransparency = 1;
})
local layout = service.New("UIListLayout", {
Parent = frame;
FillDirection = "Vertical";
HorizontalAlignment = "Center";
VerticalAlignment = "Top";
})
for i,v in options do
frame:Add("TextButton", {
Text = v.Text;
Size = UDim2.new(1, 0, 0, 30);
OnClick = function()
answer = v.Data;
done = true;
window:Destroy();
end;
})
end
frame.CanvasSize = UDim2.new(0, 0, 0, layout.AbsoluteContentSize.Y)
frame.CanvasPosition = Vector2.new(0, layout.AbsoluteContentSize.Y)
gTable = window.gTable
window:Ready()
repeat task.wait() until done == true;
return answer
end