Hey everyone, testing a new chatservice for a new map used for a clan and I keep being meant with this error.
Infinite Yield possible on ‘ServiceScriptService:WaitForChild(“ChatServiceRunner”)’
local DIRE = 871005653
local STANDARD_COLOR = Color3.fromRGB(18, 238, 212)
local ServerScriptService = game:GetService("ServerScriptService")
local Players = game:GetService("Players")
local Chat = game:GetService("Chat")
local ChatService = require(ServerScriptService:WaitForChild("ChatServiceRunner"):WaitForChild("ChatService"))
function GetTags(player: Player, speaker)
local tags = {}
local rank = player:GetRankInGroup(34026213)
local function AddTag(text: string, color: Color3)
table.insert(tags, {TagText = text, TagColor = color})
end
local function AddIcon(id: number, color: Color3)
table.insert(tags, {TagImage = "rbxassetid://" .. id, TagColor = color})
end
local function SetChatColor(color: Color3)
speaker:SetExtraData('ChatColor', color)
end
if player.UserId == DIRE or player:GetRankInGroup(34026213) == 250 then -- Dire's/Highlord's custom
AddIcon(9477205088, Color3.fromRGB(148, 0, 0)) -- 148, 0, 0
SetChatColor(Color3.fromRGB(212, 106, 108)) -- 212, 106, 108
return tags
end
-- Tal'darim tag
local taldarimRank = player:GetRankInGroup(34026213)
if taldarimRank > 0 and taldarimRank <= 254 then
AddIcon(9362626867, Color3.fromRGB(170, 64, 66))
end
-- Shadow Guard tag
local shadowRank = player:GetRankInGroup(14519836)
if shadowRank > 20 and shadowRank <= 220 then
AddIcon(9362626777, Color3.fromRGB(0, 0, 121))
end
-- Nerazim tag
local nerazimRank = player:GetRankInGroup(6215166)
if nerazimRank > 0 and nerazimRank <= 252 then
AddIcon(9362626777, Color3.fromRGB(72, 207, 97))
end
-- local phaseRank = player:GetRankInGroup(6196473)
-- if (phaseRank > 0 and phaseRank < 253) or phaseRank == 255 then
-- AddIcon(9362627332, Color3.fromRGB(233, 30, 99))
-- end
if rank == 255 then -- Hierarch
AddIcon(9477205088, Color3.fromRGB(225, 0, 225))
SetChatColor(Color3.fromRGB(225, 0, 225))
elseif rank == 250 then -- Vice Hierarch
AddIcon(9362627332, Color3.fromRGB(233, 30, 99))
AddIcon(9477205088, Color3.fromRGB(148, 0, 211))
elseif rank == 220 then -- Executor
AddIcon(9477205088, Color3.fromRGB(0, 170, 255))
elseif rank == 200 then -- Patriarch
AddIcon(9477205088, Color3.fromRGB(255, 215, 0))
elseif rank == 190 then -- Praetor
AddIcon(9477205088, Color3.fromRGB(225, 188, 0))
elseif rank == 180 then -- Prelate
AddIcon(9477205088, Color3.fromRGB(225, 188, 0))
elseif rank == 19 then -- Phasesmith
AddIcon(9362627332, Color3.fromRGB(233, 30, 99))
elseif rank == 18 then -- Judicator
AddIcon(9477205088, Color3.fromRGB(255, 24, 0))
elseif rank == 17 then -- High Templar
AddIcon(9477205088, Color3.fromRGB(231, 76, 60))
elseif rank == 16 then -- Templar
AddIcon(9477205088, Color3.fromRGB(231, 76, 60))
elseif rank == 13 then -- Entaro Fallen
AddTag('En Taro', Color3.fromRGB(233, 195, 219))
elseif rank == 12 then -- Oracle
AddIcon(9477205088, Color3.fromRGB(50, 216, 119))
elseif rank >= 10 then -- MR
AddIcon(9477205088, Color3.fromRGB(36, 155, 86))
end
return tags
end
ChatService.SpeakerAdded:Connect(function(playerName)
local speaker = ChatService:GetSpeaker(playerName)
local player = speaker:GetPlayer()
-- Tags
if player then
speaker:SetExtraData('Tags', GetTags(player, speaker))
end
end)