Description

This is staff notify alert script and you can use it with your favourite executor.

Features

  • + staff alert notify

Script

Add Xeno Scripts as a preferred source
local Players = game:GetService("Players")
local TweenService = game:GetService("TweenService")

local groupId = 13985019

local soundId = "rbxassetid://3165700530"
local soundVolume = 0.9

local toastLifetime = 6
local maxToasts = 4

local globalOrder = 0

local function waitForPlayerGui(plr)
	local pg = plr:FindFirstChildOfClass("PlayerGui")
	if pg then return pg end
	return plr:WaitForChild("PlayerGui", 15)
end

local function ensureGui(plr)
	local pg = waitForPlayerGui(plr)
	if not pg then return nil end

	local gui = pg:FindFirstChild("join_notify_gui")
	if gui then return gui end

	gui = Instance.new("ScreenGui")
	gui.Name = "join_notify_gui"
	gui.ResetOnSpawn = false
	gui.IgnoreGuiInset = true
	gui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
	gui.Parent = pg

	local holder = Instance.new("Frame")
	holder.Name = "holder"
	holder.BackgroundTransparency = 1
	holder.Size = UDim2.fromOffset(390, 300)
	holder.Position = UDim2.new(1, -410, 0, 18)
	holder.Parent = gui

	local layout = Instance.new("UIListLayout")
	layout.Padding = UDim.new(0, 10)
	layout.SortOrder = Enum.SortOrder.LayoutOrder
	layout.VerticalAlignment = Enum.VerticalAlignment.Top
	layout.Parent = holder

	local sound = Instance.new("Sound")
	sound.Name = "alert_sound"
	sound.SoundId = soundId
	sound.Volume = soundVolume
	sound.Parent = gui

	return gui
end

local function formatShown(name, displayName)
	if displayName and tostring(displayName) ~= tostring(name) then
		return tostring(displayName) .. " (@" .. tostring(name) .. ")"
	end
	return "@" .. tostring(name)
end

local function countCards(holder)
	local n = 0
	for _, ch in ipairs(holder:GetChildren()) do
		if ch:IsA("Frame") then
			n += 1
		end
	end
	return n
end

local function removeOldestIfNeeded(holder)
	while countCards(holder) > maxToasts do
		local oldest
		for _, ch in ipairs(holder:GetChildren()) do
			if ch:IsA("Frame") then
				if not oldest or ch.LayoutOrder < oldest.LayoutOrder then
					oldest = ch
				end
			end
		end
		if oldest then
			oldest:Destroy()
		else
			break
		end
	end
end

local function playAlert(gui)
	local s = gui:FindFirstChild("alert_sound")
	if not s then return end
	s.SoundId = soundId
	s.Volume = soundVolume
	pcall(function()
		s:Stop()
		s.TimePosition = 0
	end)
	s:Play()
end

local function makeToast(plr, titleText, bodyText)
	local gui = ensureGui(plr)
	if not gui then return end

	local holder = gui:FindFirstChild("holder")
	if not holder then return end

	globalOrder += 1

	local card = Instance.new("Frame")
	card.LayoutOrder = globalOrder
	card.BackgroundColor3 = Color3.fromRGB(18, 18, 22)
	card.BackgroundTransparency = 1
	card.BorderSizePixel = 0
	card.Size = UDim2.new(1, 0, 0, 10)
	card.AutomaticSize = Enum.AutomaticSize.Y
	card.Parent = holder

	local corner = Instance.new("UICorner")
	corner.CornerRadius = UDim.new(0, 12)
	corner.Parent = card

	local stroke = Instance.new("UIStroke")
	stroke.Thickness = 2
	stroke.Transparency = 1
	stroke.Color = Color3.fromRGB(255, 90, 90)
	stroke.Parent = card

	local grad = Instance.new("UIGradient")
	grad.Rotation = 90
	grad.Color = ColorSequence.new({
		ColorSequenceKeypoint.new(0, Color3.fromRGB(28, 18, 18)),
		ColorSequenceKeypoint.new(1, Color3.fromRGB(16, 16, 18)),
	})
	grad.Parent = card

	local pad = Instance.new("UIPadding")
	pad.PaddingTop = UDim.new(0, 10)
	pad.PaddingBottom = UDim.new(0, 10)
	pad.PaddingLeft = UDim.new(0, 12)
	pad.PaddingRight = UDim.new(0, 12)
	pad.Parent = card

	local head = Instance.new("TextLabel")
	head.BackgroundTransparency = 1
	head.Size = UDim2.new(1, 0, 0, 20)
	head.Font = Enum.Font.GothamBold
	head.TextSize = 14
	head.TextXAlignment = Enum.TextXAlignment.Left
	head.TextColor3 = Color3.fromRGB(255, 210, 210)
	head.TextTransparency = 1
	head.Text = titleText
	head.Parent = card

	local body = Instance.new("TextLabel")
	body.BackgroundTransparency = 1
	body.Position = UDim2.fromOffset(0, 22)
	body.Size = UDim2.new(1, 0, 0, 10)
	body.AutomaticSize = Enum.AutomaticSize.Y
	body.Font = Enum.Font.Gotham
	body.TextSize = 13
	body.TextXAlignment = Enum.TextXAlignment.Left
	body.TextYAlignment = Enum.TextYAlignment.Top
	body.TextWrapped = true
	body.TextColor3 = Color3.fromRGB(235, 235, 235)
	body.TextTransparency = 1
	body.Text = bodyText
	body.Parent = card

	TweenService:Create(card, TweenInfo.new(0.16), {BackgroundTransparency = 0}):Play()
	TweenService:Create(head, TweenInfo.new(0.16), {TextTransparency = 0}):Play()
	TweenService:Create(body, TweenInfo.new(0.16), {TextTransparency = 0}):Play()
	TweenService:Create(stroke, TweenInfo.new(0.16), {Transparency = 0.15}):Play()

	removeOldestIfNeeded(holder)
	playAlert(gui)

	task.delay(toastLifetime, function()
		if not card.Parent then return end
		TweenService:Create(card, TweenInfo.new(0.16), {BackgroundTransparency = 1}):Play()
		TweenService:Create(head, TweenInfo.new(0.16), {TextTransparency = 1}):Play()
		TweenService:Create(body, TweenInfo.new(0.16), {TextTransparency = 1}):Play()
		TweenService:Create(stroke, TweenInfo.new(0.16), {Transparency = 1}):Play()
		task.delay(0.2, function()
			if card then card:Destroy() end
		end)
	end)
end

local function getGroupInfo(plr)
	local rank = 0
	local role = ""
	pcall(function()
		rank = plr:GetRankInGroup(groupId)
		role = plr:GetRoleInGroup(groupId)
	end)
	if role == nil or tostring(role) == "" then
		role = "brak"
	end
	return rank, tostring(role)
end

local function announceJoin(joiner)
	local rank, role = getGroupInfo(joiner)
	local shown = formatShown(joiner.Name, joiner.DisplayName)
	local body = "dolaczyl: " .. shown .. "\nranga w grupie: " .. role .. " (" .. tostring(rank) .. ")"

	for _, plr in ipairs(Players:GetPlayers()) do
		task.spawn(function()
			makeToast(plr, "powiadomienie", body)
		end)
	end
end

Players.PlayerAdded:Connect(function(plr)
	task.delay(1, function()
		announceJoin(plr)
	end)
end)
Script worked? 🚀 Boost it to #1 so others find it too.

Comments (0)

Log in to add a comment.