Training Center Name GUI

I want to make a script for my training center that when someone says a command, that person will get a GUI over their head saying the role.

Examples:

!host (user) = Put a GUI over them saying “TRAINING HOST”
!waitertrain (user) = "WAITER TRAINER)
!cooktrain (user) = “COOK TRAINER”
!exptrain (user) = “EXPEREINCED STAFF TRAINER”

You need to be rank id 245+ in the group id 5143432 to use these commands. What is the script to do this?

6 Likes

I’ve made something similar to this not long ago. You need a playerAdded function and supply msg as a parameter, them do like msg:sub("[command here]", but I don’t have the time to give you a tutorial, I’d suggest reading over the forum or watching YouTube videos. Hope this helps

1 Like

I would like to remind you that this forum is for scripting support; we’re not here to make the scripts for you.


Checking a player’s rank in a group can be achieved using Player:GetRankInGroup. This will return the rank ID for the Player.

You can use the Player.Chatted event to listen for a player to send a message. Usually, you would attach this to the Player when they join the game using the Players.PlayerAdded event.

The message received by the event can then be parsed using string functions; such as string.sub, which will allow you to check the first character of the string is your desired prefix (“!”) and string.match to check the command entered by the player. You can also use string.split to allow for multiple usernames to be specified.

You’ll also need to iterate over a list of players using Players:GetPlayers to match the username string to a player.

Finally, you’ll need to have an overhead BillboardGui pre-built, which you can clone, change the role tag text, and insert into the player’s character (Player.Character). Ensure you set the Adornee property of the BillboardGui to the player’s head, or you won’t see it.

1 Like

Would this work:

local groupid = 5143432
local minimumranktousecommand = 245
local prefix = “!”
local command = waitertrain = “WAITER TRAINER”
local command2 = cooktrain = COOK TRAINER

2 Likes

So, those are just variables. The last two assignments would cause an error. Variables can only be assigned to a single value, like so: local VariableName = Value.

Variables alone will not do anything. A variable, using yours above as an example, is like saying “when I type ‘groupid’, I am referring to 5143432.” You now need to create functions and connections in order for the script to actually do anything.

If you don’t know what to do next, @Alvin_Blox has a tutorial on YouTube on how to create custom admin commands, which are along the lines of what you’re trying to do.

3 Likes

If you want to add this to basic admin commands as a plugin I can show you how.

1 Like

If you’re still offering help, I would like you to show me.

1 Like