Training Announcements

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

right, let me run you through this…

if you want to make it so when an admin says start training it starts to read out information, you can use…

remoteEvent:FireAllClients(‘Message’, ‘Title’, ‘Body’)
wait(2)
remoteEvent:FireAllClients(‘Message’, ‘Title’, ‘Body’)

of course, you can add more messages, extend the wait time etc…


meanings (incase you don’t know)

  1. wait(value) — spaces between each message
  2. remoteEvent:FireAllClients — triggers a remote event that all the game players can see if formatted right…

this is in a plug-in format btw

Thank you I will test this now I am new to code but I know enough to edit code just barely write code.

Also next time when you post please put it in code tags so its easier to read
image

As what I said above how would I apply it to the script?

Sorry, I tried but it didn’t do anything…

(P.S. Love the Rookie!)

2 Likes

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.

I would end up with

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

Yeah that’s right I think. Give it a test let me know the outcome.

So I edited it for my uses for example

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?)

It isn’t working because Basic Admin was taken down by ROBLOX, so you’ll have to wait sadly.

And no you don’t need a remote event in ReplicatedStorage.

Oh Basic Admin is down?

It have been moderated by roblox for some reason… its unknown

And you are also missing bits of code.

Oh… may I ask what am I missing?

Oh it stills works because Nova Hotels a game I work for uses it and it is still working.

It should be…

remoteEvent:FireAllClients(‘Message’, ‘Title’, ‘Body’)

No, they republished their customised admin system most likely.

You need to make sure you have commas between the speech marks, and you also need to mark sure the first parameter is ‘Message’,