43 lines
1.7 KiB
Lua
43 lines
1.7 KiB
Lua
local template = script.Notification
|
|
local function Popup(title,message)
|
|
local notification = template:Clone()
|
|
notification.TitleLabel.Text = title
|
|
notification.ContentLabel.Text = message
|
|
notification.Parent = script.Parent.Parent.ScreenGui
|
|
notification.Position = UDim2.new(0.5,0,0.5,0)
|
|
notification.Size = UDim2.new(0,400,0,0)
|
|
notification.AnchorPoint = Vector2.one*0.5
|
|
notification.UIDragDetector.Enabled = true
|
|
notification.TitleLabel.DestroyButton.Activated:Connect(function()
|
|
notification:Destroy()
|
|
end)
|
|
end
|
|
local function Notification(title,message)
|
|
local notification = template:Clone()
|
|
notification.TitleLabel.Text = title or "Untitled"
|
|
notification.ContentLabel.Text = tostring(message)
|
|
notification.Parent = script.Parent.Left
|
|
notification.Size = UDim2.new(0,0,0,0)
|
|
notification.TitleLabel.DestroyButton.Visible = false
|
|
local tapped = function()
|
|
Popup(title,message)
|
|
end
|
|
notification.TouchTap:Connect(tapped)
|
|
notification.InputEnded:Connect(function(input)
|
|
if input.UserInputType == Enum.UserInputType.MouseButton1 then tapped() end
|
|
end)
|
|
notification:TweenSize(UDim2.new(0,210,0,0),Enum.EasingDirection.InOut,Enum.EasingStyle.Quad,0.5,true,function()
|
|
wait(3)
|
|
notification.ContentLabel.Size = UDim2.new(0,notification.ContentLabel.AbsoluteSize.X,0,notification.ContentLabel.AbsoluteSize.Y)
|
|
notification:TweenSize(UDim2.new(0,0,0,0),Enum.EasingDirection.InOut,Enum.EasingStyle.Quad,0.5,true,function()
|
|
notification:Destroy()
|
|
end)
|
|
end)
|
|
end
|
|
require(game.ReplicatedFirst.ReadyModule)
|
|
_G.Remotes.Notification.OnClientEvent:Connect(function(title,message)
|
|
Notification(title,message)
|
|
end)
|
|
_G.Events.Notification.Event:Connect(function(title,message)
|
|
Notification(title,message)
|
|
end) |