Speaker Tag (Adding More)

I have a quick question, why is this not adding the tag to the player.
After doing further debug the player does have the correct cash amount (I do have a second script adding tags for other stuff, i dont think this is a problem)

Maybe its because the person already has a tag?

ServerScript

ChatService.SpeakerAdded:Connect(function(PlrName)
	local Speaker = ChatService:GetSpeaker(PlrName)
	
	Speaker:SetExtraData('Tags', {{TagText = "100K GOAT", TagColor = Color3.fromRGB(44, 0, 251)}})
	
	

	if Players[PlrName].leaderstats.Cash.Value >= 100000 and Players[PlrName].leaderstats.Cash.Value < 1000000 then
		Speaker:SetExtraData('Tags', {{TagText = "100K GOAT", TagColor = Color3.fromRGB(255, 0, 251)}})
	else if Players[PlrName].leaderstats.Cash.Value >= 1000000 and Players[PlrName].leaderstats.Cash.Value < 10000000 then
		Speaker:SetExtraData('Tags', {{TagText = "1M GOAT", TagColor = Color3.fromRGB(255, 6, 118)}})
	else if Players[PlrName].leaderstats.Cash.Value >= 10000000 and Players[PlrName].leaderstats.Cash.Value < 100000000 then
		Speaker:SetExtraData('Tags', {{TagText = "10M GOAT", TagColor = Color3.fromRGB(255, 0, 0)}})	
	else if Players[PlrName].leaderstats.Cash.Value >= 100000000 then
		Speaker:SetExtraData('Tags', {{TagText = "100M GOAT", TagColor = Color3.fromRGB(255, 255, 255)}})		
	end
	end				
	end		
	end	

end)

You can see my test above were theres no if statement and even that fails

I don’t know too much about the lua chat system, but I think you can only have one tag. Try removing the tag first.

Still does not work, and i have seen more than one tag

Again, I’m not too sure about chat systems but I’m not sure if GetSpeaker uses this.

You’re using elseif and the first if statement has the lowest amount. Because of this, all players who are OVER 100k will get the 100k tag only. The 1m,10m,100m, will only run when a player has LESS than 100k. I suggest you reverse the order, starting from if player has more than 100m, 10m, etc.

if playerr >= 100m then
--set tag
elseif player >= 10m then
--set tag
elseif player >= 1m then
--set tag
elseif player >= 100k then
--set tag
end
1 Like

FYI you can have multiple chat tags :slight_smile:

2 Likes

Thanks, i thought so!

0-0 that profile picture

1 Like

Btw theres a couple problems with this…

1 Like

Ye this doesent wwork sadly…
Im not sure why but it does not work

1 Like

Do you get any errors? Try adding print() to sections of the setplayerdata to make sure they are running.

Do you have this line at the top


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

Could you try print the type of ā€˜PlrName’ as it may be defined as a instance not a string.

Yes i do

#9udniesfjfisejfzifseje ← so i can reply

1 Like

Also i fixed it, thanks for helping guys.

1 Like