- What do you want to achieve?
I want to implenent my announce command in Cmdr Panel - What is the issue?
I tried but its not showing the TextMessage - What solutions have you tried so far?
I have tried coding it but theres no error and it does not show the TextLabel message
This is the normal code i created without cmdr(idk how to do it in cmdr but i want to do it):
ServerScript(in serverscriptservice):
local AnnouncementCommand = ";announce"
local AuthorizedUserIDs = {3908064382}
local AnnouncementDisplayer = game.ReplicatedStorage:WaitForChild("AnnouncementDisplayer")
local Players = game:GetService("Players")
local MessagingService = game:GetService("MessagingService")
Players.PlayerAdded:Connect(function(player)
player.Chatted:Connect(function(msg)
if string.lower(string.sub(msg, 1, #AnnouncementCommand)) == string.lower(AnnouncementCommand) then
if table.find(AuthorizedUserIDs, player.UserId) then
local AnnouncementContent = string.sub(msg, #AnnouncementCommand + 2)
local data = {
Name = player.DisplayName or player.Name,
UserId = player.UserId,
Content = AnnouncementContent
}
MessagingService:PublishAsync("GlobalAnnouncements", data)
end
end
end)
end)
MessagingService:SubscribeAsync("GlobalAnnouncements", function(message)
AnnouncementDisplayer:FireAllClients(message.Data)
end)
Localscript(Inside starterplayerscripts):
local TweenService = game:GetService("TweenService")
local AnnouncementDisplayer = game.ReplicatedStorage:WaitForChild("AnnouncementDisplayer")
local AnnouncementTimeout = 5 -- Time each announcement lasts
local MaxAnnouncements = 10 -- Max stacked announcements at once
local AnnouncementSpacing = 6 -- Space between announcements
local player = game.Players.LocalPlayer
local playerGui = player:WaitForChild("PlayerGui")
-- ==== CREATE GUI PROGRAMMATICALLY ====
local screenGui = Instance.new("ScreenGui")
screenGui.Name = "AnnouncementsGui"
screenGui.ResetOnSpawn = false
screenGui.Parent = playerGui
local container = Instance.new("Frame")
container.Name = "AnnouncementContainer"
container.BackgroundTransparency = 1
container.AnchorPoint = Vector2.new(0.5, 0)
container.Position = UDim2.new(0.5, 0, 0.05, 0)
container.Size = UDim2.new(0, 400, 1, 0)
container.Parent = screenGui
local template = Instance.new("TextLabel")
template.Name = "AnnouncementTemplate"
template.Size = UDim2.new(1, 0, 0, 30)
template.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
template.BackgroundTransparency = 0.2
template.TextColor3 = Color3.new(1, 1, 1)
template.Font = Enum.Font.GothamBold
template.TextScaled = true
template.Visible = false
template.Parent = container
local Uicorner = Instance.new("UICorner")
Uicorner.Parent = template
local UIPadding = Instance.new("UIPadding")
UIPadding.PaddingTop = UDim.new(0, 2)
UIPadding.PaddingBottom = UDim.new(0, 2)
UIPadding.Parent = template
-- Track active announcements
local activeAnnouncements = {}
local function repositionAnnouncements()
for i, label in ipairs(activeAnnouncements) do
local targetY = (i - 1) * (label.Size.Y.Offset + AnnouncementSpacing)
TweenService:Create(label, TweenInfo.new(0.3, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {
Position = UDim2.new(0, 0, 0, targetY)
}):Play()
end
end
local function createAnnouncement(text)
-- Remove oldest if we exceed max
if #activeAnnouncements >= MaxAnnouncements then
local oldest = table.remove(activeAnnouncements, 1)
oldest:Destroy()
end
local newLabel = template:Clone()
newLabel.Visible = true
newLabel.TextTransparency = 1
newLabel.BackgroundTransparency = 1
newLabel.Text = text
newLabel.Parent = container
newLabel.Position = UDim2.new(0, 0, 0, container.AbsoluteSize.Y)
table.insert(activeAnnouncements, newLabel)
repositionAnnouncements()
-- Fade in
TweenService:Create(newLabel, TweenInfo.new(0.3), {
TextTransparency = 0,
BackgroundTransparency = 0.2
}):Play()
-- Auto remove after timeout
task.delay(AnnouncementTimeout, function()
for i, lbl in ipairs(activeAnnouncements) do
if lbl == newLabel then
local fadeTween = TweenService:Create(lbl, TweenInfo.new(0.3), {
TextTransparency = 1,
BackgroundTransparency = 1
})
fadeTween:Play()
fadeTween.Completed:Wait()
lbl:Destroy()
table.remove(activeAnnouncements, i)
repositionAnnouncements()
break
end
end
end)
end
-- Listen for server announcements
AnnouncementDisplayer.OnClientEvent:Connect(function(data)
local displayName = (data.UserId == 3908064382) and (data.Name .. " ✓") or data.Name
createAnnouncement(displayName .. ": " .. data.Content)
end)
I would like any kind of help made to make this implemented in Cmdr Panel