What do you want to achieve? Keep it simple and clear!
I’m trying to make a chat tags shop where you can buy certain chat tags where they appear at your chat tag.
What is the issue? Include screenshots / videos if possible!
It doesn’t give me the chat tag when buying it. Even after a successful data save and a rejoin.
Here is the buy script
local Cost = 100
local ChatTagColor = "123,255,0"
local ChatTag = "Cool"
local plr = game.Players.LocalPlayer
script.Parent.MouseButton1Click:Connect(function()
if plr:WaitForChild("leaderstats").Coins.Value >= Cost and plr:WaitForChild("SecretFolder").ChatTag.Value ~= ChatTag then
game.ReplicatedStorage.BuyEvent:FireServer(Cost,ChatTag,ChatTagColor)
script.Parent.Text = "Equipped"
elseif plr:WaitForChild("leaderstats").Coins.Value < Cost then
script.Parent.Text = "Not enough coins!"
elseif plr:WaitForChild("SecretFolder").ChatTag.Value == ChatTag then
script.Parent.Text = "You already have it equipped!"
end
end)
local ServerScriptService = game:GetService("ServerScriptService")
local ChatService = require(ServerScriptService:WaitForChild("ChatServiceRunner"):WaitForChild("ChatService"))
local Players = game:GetService("Players")
local Admin = {'Admin here'}
local LeadDev = {'Lead developer here'}
ChatService.SpeakerAdded:Connect(function(PlrName)
local Speaker = ChatService:GetSpeaker(PlrName)
for _,v in pairs(game.Players:GetPlayers()) do
if Players[PlrName].Name == v and Players[PlrName]:WaitForChild("SecretFolder").ChatTag ~= "" then
local ColorData = Players[PlrName]:WaitForChild("SecretFolder").ChatTagColor
ColorData = string.split(ColorData,",")
Speaker:SetExtraData('Tags', {{TagText = Players[PlrName]:WaitForChild("SecretFolder").ChatTag, TagColor = Color3.fromRGB(tonumber(ColorData[1]),tonumber(ColorData[2]),tonumber(ColorData[3]))}})
end
end
end)
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I can’t find the solution here.
Instead of using ChatService.SpeakerAdded why not use the Player.Chatted function and set the user’s chat tag data that way? the SpeakerAdded function only works upon joining I’m pretty sure.
I don’t think you understand what i am doing here. I am trying to make it so that there is a text (or what i call chat tags) next to your username in chat
local ServerScriptService = game:GetService("ServerScriptService")
local ChatService = require(game.ServerScriptService:WaitForChild("ChatServiceRunner"):WaitForChild("ChatService"))
local Players = game:GetService("Players")
local LeadDev = {'zaydoudou'}
game.Players.PlayerAdded:Connect(function(plr)
plr.Chatted:Connect(function()
local PlrName = plr.Name
local Speaker = ChatService:GetSpeaker(PlrName)
for _,v in pairs(LeadDev) do
if Players[PlrName].Name == v then
Speaker:SetExtraData('Tags', {{TagText = "Lead dev", TagColor = Color3.fromRGB(255,0,0)}})
end
end
end)
end)