-
-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathprompt.lua
More file actions
160 lines (123 loc) · 7.2 KB
/
prompt.lua
File metadata and controls
160 lines (123 loc) · 7.2 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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
local promptRet = {}
local useStudio
local runService = game:GetService("RunService")
local coreGui = game:GetService('CoreGui')
local fin
local tweenService = game:GetService('TweenService')
if runService:IsStudio() then
useStudio = true
end
local debounce = false
local function open(prompt)
debounce = true
prompt.Policy.Size = UDim2.new(0, 400, 0, 120)
prompt.Policy.BackgroundTransparency = 1
prompt.Policy.Shadow.Image.ImageTransparency = 1
prompt.Policy.Title.TextTransparency = 1
prompt.Policy.Notice.TextTransparency = 1
prompt.Policy.Actions.Primary.BackgroundTransparency = 1
prompt.Policy.Actions.Primary.Shadow.ImageTransparency = 1
prompt.Policy.Actions.Primary.Title.TextTransparency = 1
prompt.Policy.Actions.Secondary.Title.TextTransparency = 1
-- Show the prompt
prompt.Policy.Visible = true
prompt.Enabled = true
tweenService:Create(prompt.Policy, TweenInfo.new(0.4, Enum.EasingStyle.Exponential, Enum.EasingDirection.Out), {BackgroundTransparency = 0}):Play()
tweenService:Create(prompt.Policy.Shadow.Image, TweenInfo.new(0.25, Enum.EasingStyle.Exponential, Enum.EasingDirection.Out), {ImageTransparency = 0.6}):Play()
tweenService:Create(prompt.Policy, TweenInfo.new(0.6, Enum.EasingStyle.Quint, Enum.EasingDirection.Out), {Size = UDim2.new(0, 463, 0, 150)}):Play()
task.wait(0.15)
tweenService:Create(prompt.Policy.Title, TweenInfo.new(0.35, Enum.EasingStyle.Exponential, Enum.EasingDirection.Out), {TextTransparency = 0}):Play()
task.wait(0.03)
tweenService:Create(prompt.Policy.Notice, TweenInfo.new(0.25, Enum.EasingStyle.Exponential, Enum.EasingDirection.Out), {TextTransparency = 0.5}):Play()
task.wait(0.15)
tweenService:Create(prompt.Policy.Actions.Primary, TweenInfo.new(0.6, Enum.EasingStyle.Exponential, Enum.EasingDirection.Out), {BackgroundTransparency = 0.3}):Play()
tweenService:Create(prompt.Policy.Actions.Primary.Title, TweenInfo.new(0.25, Enum.EasingStyle.Exponential, Enum.EasingDirection.Out), {TextTransparency = 0.2}):Play()
tweenService:Create(prompt.Policy.Actions.Primary.Shadow, TweenInfo.new(0.25, Enum.EasingStyle.Exponential, Enum.EasingDirection.Out), {ImageTransparency = 0.7}):Play()
task.wait(5)
if not fin then
tweenService:Create(prompt.Policy.Actions.Secondary.Title, TweenInfo.new(0.25, Enum.EasingStyle.Exponential, Enum.EasingDirection.Out), {TextTransparency = 0.6}):Play()
debounce = false
end
end
local function close(prompt)
debounce = true
tweenService:Create(prompt.Policy, TweenInfo.new(0.3, Enum.EasingStyle.Exponential, Enum.EasingDirection.Out), {Size = UDim2.new(0, 400, 0, 110)}):Play()
tweenService:Create(prompt.Policy.Title, TweenInfo.new(0.35, Enum.EasingStyle.Exponential, Enum.EasingDirection.Out), {TextTransparency = 1}):Play()
tweenService:Create(prompt.Policy.Notice, TweenInfo.new(0.25, Enum.EasingStyle.Exponential, Enum.EasingDirection.Out), {TextTransparency = 1}):Play()
tweenService:Create(prompt.Policy.Actions.Secondary.Title, TweenInfo.new(0.25, Enum.EasingStyle.Exponential, Enum.EasingDirection.Out), {TextTransparency = 1}):Play()
tweenService:Create(prompt.Policy.Actions.Primary, TweenInfo.new(0.4, Enum.EasingStyle.Exponential, Enum.EasingDirection.Out), {BackgroundTransparency = 1}):Play()
tweenService:Create(prompt.Policy.Actions.Primary.Title, TweenInfo.new(0.25, Enum.EasingStyle.Exponential, Enum.EasingDirection.Out), {TextTransparency = 1}):Play()
tweenService:Create(prompt.Policy.Actions.Primary.Shadow, TweenInfo.new(0.25, Enum.EasingStyle.Exponential, Enum.EasingDirection.Out), {ImageTransparency = 1}):Play()
tweenService:Create(prompt.Policy, TweenInfo.new(0.2, Enum.EasingStyle.Exponential, Enum.EasingDirection.Out), {BackgroundTransparency = 1}):Play()
tweenService:Create(prompt.Policy.Shadow.Image, TweenInfo.new(0.25, Enum.EasingStyle.Exponential, Enum.EasingDirection.Out), {ImageTransparency = 1}):Play()
task.wait(1)
prompt:Destroy()
fin = true
end
function promptRet.create(title, description, primary, secondary, callback)
local prompt = useStudio and script.Parent:FindFirstChild('WarningPrompt') or game:GetObjects("rbxassetid://76963332287827")[1]
prompt.Enabled = false
if gethui then
prompt.Parent = gethui()
elseif syn and syn.protect_gui then
syn.protect_gui(prompt)
prompt.Parent = coreGui
elseif not useStudio and coreGui:FindFirstChild("RobloxGui") then
prompt.Parent = coreGui:FindFirstChild("RobloxGui")
elseif not useStudio then
prompt.Parent = coreGui
end
-- Disable other instances of the prompt
if gethui then
for _, Interface in ipairs(gethui():GetChildren()) do
if Interface.Name == prompt.Name and Interface ~= prompt then
Interface.Enabled = false
Interface.Name = "Prompt-Old"
end
end
elseif not useStudio then
for _, Interface in ipairs(coreGui:GetChildren()) do
if Interface.Name == prompt.Name and Interface ~= prompt then
Interface.Enabled = false
Interface.Name = "Prompt-Old"
end
end
end
-- Set the prompt text
prompt.Policy.Title.Text = title
prompt.Policy.Notice.Text = description
prompt.Policy.Actions.Primary.Title.Text = primary
prompt.Policy.Actions.Secondary.Title.Text = secondary
-- Handle the button clicks and trigger the callback
prompt.Policy.Actions.Primary.Interact.MouseButton1Click:Connect(function()
close(prompt)
if callback then callback(true) end
end)
prompt.Policy.Actions.Secondary.Interact.MouseButton1Click:Connect(function()
close(prompt)
if callback then callback(false) end
end)
prompt.Policy.Actions.Primary.Interact.MouseEnter:Connect(function()
if debounce then return end
tweenService:Create(prompt.Policy.Actions.Primary, TweenInfo.new(0.4, Enum.EasingStyle.Exponential, Enum.EasingDirection.Out), {BackgroundTransparency = 0}):Play()
tweenService:Create(prompt.Policy.Actions.Primary.Title, TweenInfo.new(0.4, Enum.EasingStyle.Exponential, Enum.EasingDirection.Out), {TextTransparency = 0}):Play()
tweenService:Create(prompt.Policy.Actions.Primary.Shadow, TweenInfo.new(0.4, Enum.EasingStyle.Exponential, Enum.EasingDirection.Out), {ImageTransparency = 0.45}):Play()
end)
prompt.Policy.Actions.Primary.Interact.MouseLeave:Connect(function()
if debounce then return end
tweenService:Create(prompt.Policy.Actions.Primary, TweenInfo.new(0.4, Enum.EasingStyle.Exponential, Enum.EasingDirection.Out), {BackgroundTransparency = 0.2}):Play()
tweenService:Create(prompt.Policy.Actions.Primary.Title, TweenInfo.new(0.4, Enum.EasingStyle.Exponential, Enum.EasingDirection.Out), {TextTransparency = 0.2}):Play()
tweenService:Create(prompt.Policy.Actions.Primary.Shadow, TweenInfo.new(0.4, Enum.EasingStyle.Exponential, Enum.EasingDirection.Out), {ImageTransparency = 0.7}):Play()
end)
prompt.Policy.Actions.Secondary.Interact.MouseEnter:Connect(function()
if debounce then return end
tweenService:Create(prompt.Policy.Actions.Secondary.Title, TweenInfo.new(0.4, Enum.EasingStyle.Exponential, Enum.EasingDirection.Out), {TextTransparency = 0.3}):Play()
end)
prompt.Policy.Actions.Secondary.Interact.MouseLeave:Connect(function()
if debounce then return end
tweenService:Create(prompt.Policy.Actions.Secondary.Title, TweenInfo.new(0.4, Enum.EasingStyle.Exponential, Enum.EasingDirection.Out), {TextTransparency = 0.6}):Play()
end)
task.wait(0.5)
task.spawn(open, prompt)
end
return promptRet