Gamepass/Scripting Error

You are missing local Tags = { on the very top.

local Tags = {
	["Dev"] = {TagText = "📄Dev📄", TagColor = Color3.new(0, 255, 255)},
	["VIP"] = {TagText = "VIP", TagColor = Color3.new(1, 1, 0)},
}

local ChatService = require(game:GetService("ServerScriptService"):WaitForChild("ChatServiceRunner"):WaitForChild("ChatService"))

ChatService.SpeakerAdded:Connect(function(player)
	local speaker = ChatService:GetSpeaker(player)
	local player = game.Players[player]
	
	if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.userId,17599737) then
		speaker:SetExtraData("Tags",{Tags["VIP"]})
	elseif game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.userId,19057556) and game:GetService("MarketplaceService"):UserOwnsGamePassAsync(17599737,player.userId) or player.Name == "StarTheRetroGuy" then
		speaker:SetExtraData("Tags", Tags)
	end
end)

@SirRetroGuy here’s the full fixed one

I have that written in studio, this is what I have in studio Atm.

local Tags = {
	["Dev"] = {TagText = "Dev", TagColor = Color3.new(0, 255, 255)},
	["VIP"] = {TagText = "VIP", TagColor = Color3.new(1, 0, 1)},
}

local ChatService = require(game:GetService("ServerScriptService"):WaitForChild("ChatServiceRunner"):WaitForChild("ChatService"))

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

	if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.userId,17599737) then
		speaker:SetExtraData("Tags",{Tags["VIP"]})
	elseif game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.userId,19057556) and game:GetService("MarketplaceService"):UserOwnsGamePassAsync(17599737,player.userId) or player.Name == "StarTheRetroGuy" then
		speaker:SetExtraData("Tags", Tags)
	end
end)```

Remove the ```, as it will cause a syntax error.

Copy what @77jaiz posted just in case there are any errors.

That was me trying to format it like a script on the DevForum. It’s not written like that.

	if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.userId,17599737) then
		speaker:SetExtraData("Tags",{Tags["VIP"]})
	elseif game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.userId,19057556) and game:GetService("MarketplaceService"):UserOwnsGamePassAsync(17599737,player.userId) or player.Name == "StarTheRetroGuy" then
		speaker:SetExtraData("Tags", Tags)
	end

Replace player.userId with player.UserId.

Screenshot 2022-01-07 134224


Screenshot 2022-01-07 134300

local Tags = {
	["Dev"] = {TagText = "🛠️Dev🛠️", TagColor = Color3.new(0, 255, 255)},
	["VIP"] = {TagText = "VIP", TagColor = Color3.new(1, 0, 1)},
}

local ChatService = require(game:GetService("ServerScriptService"):WaitForChild("ChatServiceRunner"):WaitForChild("ChatService"))

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

	if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId,17599737) then
		speaker:SetExtraData("Tags",{Tags["VIP"]})
	elseif game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId,19057556) and game:GetService("MarketplaceService"):UserOwnsGamePassAsync(17599737,player.userId) or player.Name == "StarTheRetroGuy" then
		speaker:SetExtraData("Tags", Tags)
	end
end)

Possibly this could work?

	if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId,17599737) then
		speaker:SetExtraData("Tags",{Tags["VIP"]})
	elseif game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId,19057556) and game:GetService("MarketplaceService"):UserOwnsGamePassAsync(17599737,player.UserId) or player.Name == "StarTheRetroGuy" then
		speaker:SetExtraData("Tags", {Tags["Dev"]})
	end

That on it’s own? Or instead of what it said before?

I edited the dev line, give it a try.

Doesn’t work, but should I be testing it in Studio, or join the actual game?

You should always test in the actual game instead of Studio.

Sorry, I just started developing last year…

Still only shows VIP tag, in the game

Try switching the lines

if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId,19057556) and game:GetService("MarketplaceService"):UserOwnsGamePassAsync(17599737,player.UserId) or player.Name == "StarTheRetroGuy" then
		speaker:SetExtraData("Tags", Tags)
elseif game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId,17599737) then
		speaker:SetExtraData("Tags",{Tags["VIP"]})
	end
2 Likes

That worked! Thank all of you for the help!

2 Likes