I’m trying to make a VIP chat tag, and to do so I need to require ChatService. I have no clue why I’m getting this yield?
script:
local gamepassId = script.GamepassID.Value
local service = game:GetService("MarketplaceService")
game.Players.PlayerAdded:Connect(function(player)
if (service:UserOwnsGamePassAsync(player.UserId, gamepassId)) then
local tags = {
{
TagText = "VIP",
TagColor = Color3.fromRGB(255, 255, 0)
}
}
local ChatService = require(game:GetService("ServerScriptService"):WaitForChild("ChatServiceRunner"):WaitForChild("ChatService"))
local speaker = nil
while speaker == nil do
speaker = ChatService:GetSpeaker(player.Name)
if speaker ~= nil then break end
task.wait(.01)
end
speaker:SetExtraData("Tags",tags)
speaker:SetExtraData("ChatColor",Color3.fromRGB(255, 255, 0))
end
end)