Something like this?
The implementation makes me dead. (You know what to do next time)
local TweenService = game:GetService("TweenService")
local Lighting = game:GetService("Lighting")
local Button = script.Parent
local Player = game:GetService("Players").LocalPlayer
local PlayerGui = Player.PlayerGui
Button.MouseButton1Click:Connect(function()
setText("Title", "Message")
end)
function setText(Title, Message)
task.spawn(function()
local BlurEffect = Instance.new("BlurEffect", Lighting)
local ScreenGui = Instance.new("ScreenGui", PlayerGui)
local TextLabel1 = Instance.new("TextLabel", ScreenGui) -- Title
local TextLabel2 = Instance.new("TextLabel", ScreenGui) -- Message
local Frame = Instance.new("Frame", ScreenGui) -- Bar
TextLabel1.AnchorPoint = Vector2.new(0.5, 0.5) -- Always setting AnchorPoint as {0, 0} or {0.5, 0.5} to reduce confusion
TextLabel2.AnchorPoint = Vector2.new(0.5, 0.5)
Frame.AnchorPoint = Vector2.new(0.5, 0.5)
TextLabel1.Position = UDim2.new(0.5, 0, -0.5, 0)
TextLabel1.Size = UDim2.new(0.3, 0, 0.1, 0)
TextLabel1.TextScaled = true
TextLabel2.Position = UDim2.new(0.5, 0, 1.5, 0)
TextLabel2.Size = UDim2.new(0.3, 0, 0.1, 0)
TextLabel2.TextScaled = true
Frame.Position = UDim2.new(0.5, 0, 0.5, 0)
Frame.Size = UDim2.new(0.5, 0, 0.05, 0)
TweenService:Create(BlurEffect, TweenInfo.new(1), {Size = 20}):Play()
task.delay(4, function()
TweenService:Create(BlurEffect, TweenInfo.new(1), {Size = 0}):Play()
end)
TextLabel1.Text = Title
TextLabel2.Text = Message
local textFadeIn1 = TweenService:Create(TextLabel1, TweenInfo.new(1), {Position = UDim2.new(0.5, 0, 0.4, 0)})
local textFadeIn2 = TweenService:Create(TextLabel2, TweenInfo.new(1), {Position = UDim2.new(0.5, 0, 0.6, 0)})
textFadeIn1:Play()
textFadeIn2:Play()
textFadeIn2.Completed:Wait()
task.wait(4)
local textFadeOut1 = TweenService:Create(TextLabel1, TweenInfo.new(1), {Position = UDim2.new(0.5, 0, -0.5, 0)})
local textFadeOut2 = TweenService:Create(TextLabel2, TweenInfo.new(1), {Position = UDim2.new(0.5, 0, 1.5, 0)})
textFadeOut1:Play()
textFadeOut2:Play()
textFadeOut2.Completed:Wait()
Frame.Visible = false
TextLabel1.Text = ""
TextLabel2.Text = ""
end)
end