in my game, I have a shop where you can buy things - one thing I’m selling is custom chat tags.
After finally getting that to work and save - I don’t know how to make the equip work.
I already have a function which adds a chat tag to a player
Summary
function core:EditSpeaker(speaker, nameColor, chatColor, tags) --// object SPEAKER, col3 NAMECOLOR, col3 CHATCOLOR, table TAGS
if not speaker then
warn('CORE MODULE ERROR (EDITSPEAKER) | No speaker defined')
return
end
if nameColor ~= "DEFAULT" then
speaker:SetExtraData('NameColor', nameColor)
else
print('Default name color')
end
if chatColor ~= "DEFAULT" then
speaker:SetExtraData('ChatColor', chatColor)
else
print('Default chat color')
end
if tags ~= "DEFAULT" then
speaker:SetExtraData('Tags', tags)
else
print("No tags specified")
end
end
However that’s not my issue - the issue is actually enabling the chat tag which is equiped. Can anyone help?
Other info if needed
Tag format
local tagData = {
Content = content.Text,
Color = {
R = color.R,
G = color.G,
B = color.B
},
Price = (string.len(content.Text)) * 500
}
so you can buy chat tags, then they are stored in a profileservice profile with the format
{
Content = content.Text,
Color = {
R = color.R,
G = color.G,
B = color.B
},
Price = (string.len(content.Text)) * 500
}
then on the UI seen in the video, it lists all the tags the player owns and has an equip button which applys the chat tag so you can actually see it in chat
however i dont know how to make the equip button work
local Players = game:GetService('Players')
local ServerScriptService = game:GetService('ServerScriptService')
ChatService = require(ServerScriptService:WaitForChild('ChatServiceRunner'):WaitForChild('ChatService'))
game.ReplicatedStorage.OnEquipped.OnServerEvent:Connect(function(Plr,Color,Content)
ChatService.SpeakerAdded:Connect(function(PlayerName)
local Speaker = ChatService:GetSpeaker(PlayerName)
Speaker:SetExtraData('Tags', {{TagText = Content, TagColor = Color}})
end)
end)
Local Script
-- Function From Which The Tag Would Be Equipped
local Color = Color3.new(color.R,color.G, color.B)
local Content = content.Text
game.ReplicatedStorage.OnEquipped:FireServer(color,Content)
-- end)
Be Sure To Have A Remote Event In Replicated Storage Name “OnEquipped”