Hello
I got this working Chat Rank script.
basically it changes the chat color, changes name color, and adds a “rank”.
Is this script 100% assured that it works for me and me only?
thanks in advance.
local sss = game:GetService("ServerScriptService")
local chatservice = require(sss:WaitForChild("ChatServiceRunner"):WaitForChild("ChatService"))
local players = game:GetService("Players")
local owner = {'Mercyvr'}
local DefaultTags = {
{TagText = "Owner", TagColor = Color3.fromRGB(255,215,0)}, --1st tag
}
chatservice.SpeakerAdded:Connect(function(plrname)
local speaker = chatservice:GetSpeaker(plrname)
for _, v in pairs(owner) do
if players[plrname].Name == v then
speaker:SetExtraData("Tags", DefaultTags)
speaker:SetExtraData("NameColor", Color3.fromRGB(255, 155, 0))
speaker:SetExtraData("ChatColor", Color3.fromRGB(0, 255, 255))
end
end
end)
```*
Yes it should do as every time a player speaks your function grabs that player and in your loop, it will verify if the player is in the owner table or not.
thank you for the suggestion! i successfully changed it lol (I have no clue how I managed to make it work bc I’m a terrible scripter but well ain’t complaining haha)
You don’t need to loop through the Players service to get a player. ChatSpeaker provides GetPlayer if you need to get the player object associated with a ChatSpeaker assuming it’s a player speaker.
local ServerScriptService = game:GetService("ServerScriptService")
local ChatService = require(ServerScriptService:WaitForChild("ChatServiceRunner").ChatService)
-- Don't need a table if it's just for yourself. Use game.CreatorId if it's
-- a place on your profile or your own id if not.
local OWNER_ID = 204410354
local DEFAULT_TAGS = {
-- Your tag here, not rewriting it.
}
local function speakerAdded(speakerName)
local speaker = ChatService:GetSpeaker(speakerName)
local player = speaker:GetPlayer()
if player and player.UserId == OWNER_ID then
-- SetExtraData calls here
end
end
-- You need this to resolve race conditions
ChatService.SpeakerAdded:Connect(speakerAdded)
for _, speaker in ipairs(ChatService:GetSpeakerList()) do
speakerAdded(speaker)
end