Roblox Moderator Tag Script
Roblox Moderator Tag Script
The script uses the PlayerAdded event to detect when a player joins the game, and within this, it uses CharacterAdded to wait until the player's character is loaded, then creates a moderator tag if TagsAtivadas is true and if the player is in the Moderadores list. For existing players, it directly attaches to the CharacterAdded event to do the same, ensuring constant monitoring and updating of character status .
The script listens for chat commands through the LocalPlayer.Chatted function. If the local player is a moderator, they can use the ';tag' command to activate tags for all moderators by setting TagsAtivadas to true and updating all tags with AtualizarTags(). They can also use the ';untag' command to remove their own tag by calling RemoverTag(LocalPlayer).
The script controls tag visibility by setting a MaxDistance property on the BillboardGui to 30 studs. This limits the distance at which the tag is visible, ensuring that it only appears when the player's head is relatively close to the camera, thus preventing clutter from tags in the background of distant characters .
The script uses a table named Tags to keep track of players who currently have a tag. Each player's tag, once created, is stored in this table. The AtualizarTags() function iterates over all players, checking if they are in the Moderadores list and whether TagsAtivadas is true to create or remove tags accordingly. This ensures that the tag list is synchronized with current game state and settings .
The script uses the CharacterAdded event to ensure that the moderator tag is applied to a player's character as soon as it spawns or respawns in the game. This is necessary because the character model, including the head, needs to be available before the tag can be attached to it, thereby allowing the script to dynamically manage tags each time a moderator enters the game world .
The use of Enum.Font.GothamBold in the script is for styling the TextLabel component of the moderator tag's BillboardGui. GothamBold is a clear and bold font, which makes the '.•° Moderador °○.' text prominent and easily readable, enhancing the visual identification of moderators in the game. While it does not directly affect functionality, it improves the clarity and professionalism of the game interface .
The script ensures only authorized users can execute tag-related commands by checking if the LocalPlayer's name exists in the Moderadores table. If not, the function connected to chat commands returns immediately without executing any tag-related logic, thereby preventing unauthorized command execution .
The script identifies players who are allowed to have moderator tags by checking their names against a predefined list of authorized moderators. This list is stored in a Lua table named 'Moderadores', where each moderator's username is set as a key with the value 'true' .
The GUI components used include a BillboardGui, Frame, UICorner, and TextLabel. BillboardGui holds the tag above the player's head. The Frame serves as a background with black color and 0.2 transparency, giving the tag a slight dark backdrop. The UICorner provides rounded edges to the Frame, and the TextLabel contains the text '.•° Moderador °○.', scaled and colored light blue to make it prominent. Together, they form a cohesive visual element that identifies moderators .
The BillboardGui element serves as the visual representation of the moderator tag above the player's head. It is configured with a size of UDim2.new(0, 150, 0, 35) and an offset of Vector3.new(0, 3.9, 0) to make it visible above the head. The tag is styled with a Frame, a UICorner for rounded edges, and a TextLabel displaying '.•° Moderador °○.' in light blue color, set to be always on top and visible up to a maximum distance of 30 studs .