local Players = game:GetService("Players")
local LocalPlayer = Players.LocalPlayer
local TweenService = game:GetService("TweenService")
-- Create notification GUI
local NotificationGui = Instance.new("ScreenGui")
NotificationGui.Parent = game.CoreGui
local NotificationLabel = Instance.new("TextLabel")
NotificationLabel.Size = UDim2.new(0, 300, 0, 50)
NotificationLabel.Position = UDim2.new(0.5, -150, 0, -900000)
NotificationLabel.BackgroundTransparency = 1
NotificationLabel.Font = Enum.Font.GothamBold
NotificationLabel.TextSize = 20
NotificationLabel.Parent = NotificationGui
-- Create sounds
local JoinSound = Instance.new("Sound")
JoinSound.SoundId = "rbxassetid://170765130"
JoinSound.Volume = 1
JoinSound.Parent = NotificationGui
local LeaveSound = Instance.new("Sound")
LeaveSound.SoundId = "rbxassetid://5153734236"
LeaveSound.Volume = 1
LeaveSound.Parent = NotificationGui
local function showNotification(text, isJoining)
NotificationLabel.TextTransparency = 0
NotificationLabel.Text = text
NotificationLabel.TextColor3 = isJoining and Color3.fromRGB(0, 255, 0) or Color3.fromRGB(255, 0, 0)
local showTween = TweenService:Create(NotificationLabel,
TweenInfo.new(0.5, Enum.EasingStyle.Sine),
{Position = UDim2.new(0.5, -150, 0, 5)})
showTween:Play()
if isJoining then
JoinSound:Play()
else
LeaveSound:Play()
end
wait(2.5)
local fadeTween = TweenService:Create(NotificationLabel,
TweenInfo.new(0.5, Enum.EasingStyle.Sine),
{TextTransparency = 1, Position = UDim2.new(0.5, -150, 0, -50)})
fadeTween:Play()
end
Players.PlayerAdded:Connect(function(player)
if LocalPlayer:IsFriendsWith(player.UserId) then
showNotification(player.Name.." joined!", true)
end
end)
Players.PlayerRemoving:Connect(function(player)
if LocalPlayer:IsFriendsWith(player.UserId) then
showNotification(player.Name.." left!", false)
end
end)
To embed this project on your website, copy the following code and paste it into your website's HTML: