Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

[SOLVED] How would I change a player's chat's tags and chat colour mid-game?

Asked by
LawlR 182
5 years ago
Edited 5 years ago

I've edited the ExtraDataInitalizer module.

if pLaYeR:FindFirstChild("Playerstats") then
                local pLaYeRsTaTs = pLaYeR:FindFirstChild("Playerstats")
                if pLaYeRsTaTs:FindFirstChild("CurrentChatTag") and pLaYeRsTaTs:FindFirstChild("CurrentChatColour") then
                    local CurrentChatTag = pLaYeRsTaTs:FindFirstChild("CurrentChatTag")
                    local CurrentChatColour = pLaYeRsTaTs:FindFirstChild("CurrentChatColour")
                    if CurrentChatTag.Value == nil or CurrentChatColour == nil then

                    else
                        local tags = {
                            {
                                TagText = tostring(CurrentChatTag.Value),
                                TagColor = Color3.fromRGB(CurrentChatColour.Value)
                            }
                        }
                        speaker:SetExtraData("Tags", tags)
                        speaker:SetExtraData("NameColor", Color3.fromRGB(tags[2]))
                        speaker:SetExtraData("ChatColor",  pLaYeR.TeamColor.Color)
                    end
                end
            end

This sets the tags and colour when the player joins the game, but I would like the player to choose what tag and colour they want. The player would currently have to rejoin in order for the new tag to appear. How would I make it so that it updates in the server?

Edit: I just added a simple while loop and put all of it into a spawn function. Probably not the best way to do it, but it works. If there's a better way, let me know!

1 answer

Log in to vote
1
Answered by
Amiaa16 3227 Moderation Voter Community Moderator
5 years ago

You don't need to edit the modules. They are made in a way to be able to use them easily.

First you want to get the ChatService by requiring its module:

local ChatService = require(game:GetService("ServerScriptService").ChatServiceRunner.ChatService)

Then, get a chat speaker you want

local speaker = ChatService:GetSpeaker("LawIR") --must be a string

Finally, do whatever you want, such as set the extra data

speaker:SetExtraData("TextSize", 20)

You can find the documentation here

0
Oh well. Thanks though. I'll remember this for furore projects. LawlR 182 — 5y
0
Future*. The way I solved it wasn't too complicated anyway. LawlR 182 — 5y
Ad

Answer this question