Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Chat tag doesnt work anymore when i added VIP tag how to fix it?

For more information: No Errors When i added the VIP tag it doesnt work anymore

local plrs = game.Players
local sss = game.ServerScriptService
local groupId = 3823781113--7870490
local chatService = require(sss:WaitForChild('ChatServiceRunner'):WaitForChild('ChatService'))

chatService.SpeakerAdded:Connect(function(plr)
	local speaker = chatService:GetSpeaker(plr)
if plrs[plr]:IsInGroup(groupId) then
		speaker:SetExtraData('NameColor', Color3.fromRGB(0, 255, 178))
		speaker:SetExtraData('Tags', {{TagText = plrs[plr]:GetRoleInGroup(groupId), TagColor = Color3.fromRGB(255, 37, 37)}})
elseif game:GetService("MarketplaceService"):UserOwnsGamePassAsync(plrs[plr].UserId,11925428) then
		speaker:SetExtraData('NameColor', Color3.fromRGB(253, 255, 79))
		speaker:SetExtraData('Tags', {{TagText = "VIP", TagColor = Color3.fromRGB(255, 255, 0)}})
	end
end)

2 comments

0

Both tags don't work?

0

Wait I just reazlied your groupId is invalid

1 answer

✓ Accepted answer

I'm assuming 'Fans' tag is still working but not for 'VIP' tag this is because I tested your script. I think the reason is this line ( line 8-14 in your post ):

if plrs[plr]:IsInGroup(groupId) then
	speaker:SetExtraData('NameColor', Color3.fromRGB(0, 255, 178))
	speaker:SetExtraData('Tags', {{TagText = plrs[plr]:GetRoleInGroup(groupId), TagColor = Color3.fromRGB(255, 37, 37)}})

elseif game:GetService("MarketplaceService"):UserOwnsGamePassAsync(plrs[plr].UserId,11925428) then
	speaker:SetExtraData('NameColor', Color3.fromRGB(253, 255, 79))
	speaker:SetExtraData('Tags', {{TagText = "VIP", TagColor = Color3.fromRGB(255, 255, 0)}})
end

First if statement checks if you are in the group and second if statement checks if you own VIP gamepass.

Problem: First if statement checks if you are in the group, if so then your 'elseif statement' won't run.

What you need to do is to change it to an if statement.

Example Code: ( I organize the code a little bit so it's easier to read with your actual groupId )

local plrs = game.Players
local sss = game.ServerScriptService
local CSR = sss:WaitForChild("ChatServiceRunner")
local groupId = 7870490
local chatService = require(CSR:WaitForChild('ChatService'))

chatService.SpeakerAdded:Connect(function(plr)
	local player = plrs[plr]	
	local Tags = {
		{{
			TagText = player:GetRoleInGroup(groupId), 
			TagColor = Color3.fromRGB(255, 37, 37)
		}},

		{{
			TagText = "VIP", 
			TagColor = Color3.fromRGB(255, 255, 0)
		}}
	}

	local speaker = chatService:GetSpeaker(plr)
	if player:IsInGroup(groupId) then
		speaker:SetExtraData('NameColor', Color3.fromRGB(0, 255, 178))
		speaker:SetExtraData('Tags', Tags[1])
	end

	local MPS = game:GetService("MarketplaceService")
	local ownGamepass = MPS:UserOwnsGamePassAsync(player.UserId, 11925428)
	if ownGamepass then
		speaker:SetExtraData('NameColor', Color3.fromRGB(253, 255, 79))
		speaker:SetExtraData('Tags', Tags[2])
	end
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.