Hi! So I own a Roblox game called Cafe G it is in the works of a V2 and I want to make an announcement system for our training center so when I run “starttraining” it will run multiple announcements one after another using BAE and they uses the SM type of announcement and different titles and body of every announcement I have this code so far. `
local Plugin = function(...)
local Data = {...}
-- Plugin Configuration --
local pluginConfig = {
-- Command prefix
commandPrefix = "",
-- Announcement sequence for starttraining command
startTrainingAnnouncements = {
{ title = "Training Session Started", text = "Welcome to the training session! Please listen carefully to the instructions.", delay = 5, },
{ title = "Rules Reminder", text = "Remember to follow the rules and listen to your trainers.", delay = 3, },
{ title = "Get Ready", text = "The training session will begin shortly. Get ready!", delay = 2, },
{ title = "Let's Begin", text = "The training session has started. Let's begin!", delay = 1, },
}
}
-- Included Functions and Info --
local remoteEvent = Data[1][1]
local remoteFunction = Data[1][2]
local returnPermissions = Data[1][3]
local Commands = Data[1][4]
local Prefix = Data[1][5]
local actionPrefix = Data[1][6]
local returnPlayers = Data[1][7]
local cleanData = Data[1][8]
-- Function to make an announcement
local function makeAnnouncement(title, text)
remoteEvent:FireClient(nil, 'Lobby Announcement', title .. ": " .. text)
end
-- Function to run the starttraining command
local function startTrainingCommand(player)
-- Loop through the announcements and make each one with a delay
for i, announcement in pairs(pluginConfig.startTrainingAnnouncements) do
makeAnnouncement(announcement.title, announcement.text)
wait(announcement.delay)
end
end
-- Connect to the player's message event
game.Players.PlayerAdded:Connect(function(player)
player.Message:Connect(function(message)
-- Check if the message starts with the command prefix
if message:sub(1, 1) == pluginConfig.commandPrefix then
-- Get the command
local command = message:sub(2):match("^%s*%w+")
-- Check if the command is starttraining
if command == "starttraining" then
startTrainingCommand(player)
end
end
end)
end)
-- Return Everything to the MainModule --
local pluginName = 'starttraining'
local pluginPrefix = Prefix
local pluginLevel = 2
local pluginUsage = ""
local pluginDescription = "Send a series of announcements to all players when the starttraining command is run."
return pluginName, startTrainingCommand, pluginLevel, pluginPrefix, {pluginName, pluginUsage, pluginDescription}
end
return Plugin
Your script is over complicated and has way to much that doesn’t need to be there. Get rid of everything you added, and put my code in the section where you code the plug-in.
local Plugin = function(...) local Data = {...}
-- Included Functions and Info --
local remoteEvent = Data[1][1]
local remoteFunction = Data[1][2]
local returnPermissions = Data[1][3]
local Commands = Data[1][4]
local Prefix = Data[1][5]
local actionPrefix = Data[1][6]
local returnPlayers = Data[1][7]
local cleanData = Data[1][8] -- cleanData(Sender,Receiver,Data)
-- Practical example, for a gui specifically for a player, from another player
-- cleanData(Sender,Receiver,"hi") -- You need receiver because it's being sent to everyone
-- Or for a broadcast (something everyone sees, from one person, to nobody specific)
-- cleanData(Sender,nil,"hi") -- Receiver is nil because it is a broadcast
-- Plugin Configuration --
local pluginName = 'Starttraining'
local pluginPrefix = Prefix
local pluginLevel = 2
local pluginUsage = "" -- leave blank if the command has no arguments
local pluginDescription = "Start Training Announcement"
-- Example Plugin Function --
remoteEvent:FireAllClients(‘’, ‘Title’, ‘Body’)
wait(2)
remoteEvent:FireAllClients(‘’, ‘Title’, ‘Body’)
-- Return Everything to the MainModule --
local descToReturn
if pluginUsage ~= "" then
descToReturn = pluginPrefix..pluginName..' '..pluginUsage..'\n'..pluginDescription
else
descToReturn = pluginPrefix..pluginName..'\n'..pluginDescription
end
return pluginName,pluginFunction,pluginLevel,pluginPrefix,{pluginName,pluginUsage,pluginDescription}
end
return Plugin
local Plugin = function(...)
local Data = {...}
-- Included Functions and Info --
local remoteEvent = Data[1][1]
local remoteFunction = Data[1][2]
local returnPermissions = Data[1][3]
local Commands = Data[1][4]
local Prefix = Data[1][5]
local actionPrefix = Data[1][6]
local returnPlayers = Data[1][7]
local cleanData = Data[1][8] -- cleanData(Sender,Receiver,Data)
-- Practical example, for a gui specifically for a player, from another player
-- cleanData(Sender,Receiver,"hi") -- You need receiver because it's being sent to everyone
-- Or for a broadcast (something everyone sees, from one person, to nobody specific)
-- cleanData(Sender,nil,"hi") -- Receiver is nil because it is a broadcast
-- Plugin Configuration --
local pluginName = 'Starttraining'
local pluginPrefix = Prefix
local pluginLevel = 2
local pluginUsage = "" -- leave blank if the command has no arguments
local pluginDescription = "Start Training Announcement"
-- Example Plugin Function --
remoteEvent:FireAllClients(‘Greetings! My alias is Ciao, I am your host today!’, ‘Lobby Announcements’, ‘Body’)
wait(12)
remoteEvent:FireAllClients(‘’, ‘Title’, ‘Body’)
-- Return Everything to the MainModule --
local descToReturn
if pluginUsage ~= "" then
descToReturn = pluginPrefix..pluginName..' '..pluginUsage..'\n'..pluginDescription
else
descToReturn = pluginPrefix..pluginName..'\n'..pluginDescription
end
return pluginName,pluginFunction,pluginLevel,pluginPrefix,{pluginName,pluginUsage,pluginDescription}
end
return Plugin
And unfortunately it doesn’t work so the outcome is when I try to click the button to display all commands nothing comes up so I do “cmds” in chat and the CMDS appear but nowhere it shows the plugin.
(Also do I need like a Remote Event in replicated storage?)