Gamepass/Scripting Error

Hello Developers
Recently I created a post about a game, that game contains a few gamepasses that reward chat tags.
Only for developers
Is there a way for me to let one name tag show and not the other? For instance I have a Dev tag, but I own the VIP Gamepass and would like to make a tag for VIP, but it always deletes my Dev tag. How do I fix this?

The way I would do it is in the .chatted (wherever you are setting the tag at in chat) make a hierarchy condition block for tags

check if player is a dev then tag = dev tag and then skip any lower hierarchy if not a dev check the next hierarchy and etc.

1 Like

Hypothetically, I don’t understand a single thing you just said. Could you put it into terms that a very new developer can understand? I’m not experienced in scripting.

1 Like

you need to show code before i can help you cause idk why if statement conditions dont make sense?

1 Like

For which tag? I have four, or all of them? They run two scripts a tag.

1 Like

are these chat tags? maybe i do not understand

1 Like

Sorry yes, chat tags that are currently running by each dev owning a Gamepass and me using the marketplace ID to give owners of the pass the chat tag.

1 Like

I am just a little confused why you have the chat tags separated and in 2 scripts at that,

provide code for dev chat tag first so i can get an idea what u are doing

1 Like

If you can show us some code, it will help us diagnose the problem. Otherwise it is very difficult to understand the problem you are experiencing without any context.

1 Like

Here is script 1:

local service = game:GetService("MarketplaceService")
game.Players.PlayerAdded:Connect(function(player)
    if (service:UserOwnsGamePassAsync(player.UserId, gamepassId)) then
        local tags = {
            {
				TagText = "📄Dev📄",
                TagColor = Color3.fromRGB(0, 255, 255)
            }
        }
        local ChatService = require(game:GetService("ServerScriptService"):WaitForChild("ChatServiceRunner").ChatService)
        local speaker = nil
        while speaker == nil do
            speaker = ChatService:GetSpeaker(player.Name)
            if speaker ~= nil then break end
            wait(0.01)
        end
        speaker:SetExtraData("Tags",tags)
        speaker:SetExtraData("ChatColor",Color3.fromRGB(0, 255, 255))
    end
end)’’’
1 Like

Script Two:

local mps = game:GetService("MarketplaceService")
local gamepass = 19057556 -- Dev Gamepass ID

game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(char)
		if mps:UserOwnsGamePassAsync(player.UserId,gamepass) == true then
			game.ReplicatedStorage.NameTags:WaitForChild("📄Dev📄"):Clone().Parent = char.Head
		end	
		
	end)
end) 
1 Like

Each respective Gamepass follows the same basic idea of the scripts. Just changing the Gamepass ID, and what the tag actually is.

1 Like

Ok you really need to have a singular script handle all chat tags and name tags otherwise my suggestion earlier will not work (or atleast be tedious to implement) brb with some code

1 Like
local tags = {
	[0] = {TagText = "DEV", TagColor = Color3.fromRGB(170, 85, 255)}, 
	[1] = {TagText = "VIP", TagColor = Color3.fromRGB(198, 0, 0)},	
}

chatService.SpeakerAdded:Connect(function(playerName)
	local speaker = chatService:GetSpeaker(playerName)
	local player = game.Players[playerName]

	if MarketplaceService:UserOwnsGamePassAsync( 19057556 , player.UserId ) then
		speaker:SetExtraData("Tags",{tags[0]})
        --insert vip tag here
	elseif player.UserId==8629539 then
		speaker:SetExtraData("Tags",{tags[1]})
        --insert dev name tag here
	else
		return
	end
end)

this is one of the ways to use a singular script for nametags and chat tags

you will need to be careful how you construct it, the if statement i set to the vip gamepass, elseif’s will activate instead if someone’s else if is true.

1 Like

If you are not aware, purchasing in roblox studio will not save. However, I think if the gamepass is personally created by you, and not under your group, you will automatically own it. Back on topic, make sure that you own the gamepass,you could set the price to one robuk and buy it. Maybe then, it’ll work.

1 Like

I own both the VIP Gamepass which I would like to make a tag for, and I own a special Gamepass for the Dev tag.

1 Like

With the script you provided, I replace the chat tag scripts, (all of them?) with this. Where do I enter the Gamepass IDs?

1 Like

you would want to replace them all yes, be sure to keep in mind hierarchy when constructing your own.

i.e. which tag gets high priority

1 Like

I’m a little confused here, the UserId, do I put my ID there?

The code I provide is simply sample code to work with–seeing as your dev thing is gamepass related, you would not utilize player.UserId