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

How do you make a special chat tag if you own a gamepass?

Asked by 2 years ago
Edited 2 years ago

So I have a script I'm using where if you buy a gamepass it gives a unique chat tag, for example, if you buy the VIP gamepass the chat tag will be (VIP), so this is the script:


local ServerScriptService = game:GetService("ServerScriptService") local MarketplaceService = game:GetService("MarketplaceService")

local ChatService = require(ServerScriptService:WaitForChild("ChatServiceRunner").ChatService)

local GAME_PASS_ID = 0000000

local VIP_TAGS = { { TagText = "?????VIP", TagColor = Color3.new(1, 1, 0) } }

local function speakerAdded(speakerName) local speaker = ChatService:GetSpeaker(speakerName) local player = speaker:GetPlayer()

if player then
    if MarketplaceService:UserOwnsGamePassAsync(player.UserId, GAME_PASS_ID) then
        speaker:SetExtraData("Tags", VIP_TAGS)
        speaker:SetExtraData("ChatColor", Color3.fromRGB(0, 226, 226))
    end
end

end

ChatService.SpeakerAdded:Connect(speakerAdded) for _, speaker in ipairs(ChatService:GetSpeakerList()) do speakerAdded(speaker)

end

I was wondering if I have multiple badges that each give a unique chat tag, for example, Mega VIP gamepass gives (Mega VIP) chat tag, VIP gamepass gives (VIP) chat tag, Donation gamepass gives (Donator) chat tag, etc...

How can I make it so that if a person buys all of these gamepasses I give priority for one of them over the other? Like if they own all badges I want the (Mega VIP) chat tag to appear and not the rest?

Also, how can I make it so that if you own 2 of the gamepasses like the VIP and Mega VIP gamepasses, it gives another new unique chat tag like (Ultra VIP) for owning both of the gamepasses?

Sorry for the long question, Thanks in advance!

Answer this question