Help with a chat tag system

I’m currently around a year into making a system for chat tags. The way I want it to work is you have an inventory, where you can click on various chat tags that will then be equipped in the chat.
However, I keep on running into the same problem; whenever you click on a chat tag in the inventory GUI to equip it, only the person who equips the tag can see it. I’ve deduced this issue down to it being a Local Script where the tag itself doesn’t apply for other players, but I have no clue how to even begin fixing it. I’ve searched far and wide and have found no solutions to my problem, or I have and I somehow messed it up while implementing the fix.

Below is one of the equipable tags, when it’s clicked on it checks if you are in a group, and if you are it equips the tag. However as stated above it only equips it for the player who clicked, not anybody else.

local TextChatService = game:GetService("TextChatService")
local GroupEvent = game.ReplicatedStorage.GroupEvent
local GroupId = 3283151
local sound = game.Workspace.Wrong

sound.TimePosition = 0

script.Parent.TextColor3 = Color3.fromHex("#ed379b")

script.Parent.MouseButton1Click:Connect(function()

	if game.Players.LocalPlayer:IsInGroup(GroupId) then

		TextChatService.OnIncomingMessage = function(Message: TextChatMessage)
			
			local properties = Instance.new("TextChatMessageProperties")

			if Message.TextSource then
				
				local player = game:GetService("Players"):GetPlayerByUserId(Message.TextSource.UserId)

				if game.Players.LocalPlayer:IsInGroup(GroupId) and player == game.Players.LocalPlayer then

					properties.PrefixText = "<font color='#ed379b'>[Patron]</font> " .. Message.PrefixText

				end

			end

			return properties

		end

	end
	
	if not game.Players.LocalPlayer:IsInGroup(GroupId) then

		sound:Play()
		script.Parent.Parent.Parent.GroupCheck.TextTransparency = 0
		script.Parent.Parent.Parent.BuilderFrame.TextButton.Interactable = false
		script.Parent.Parent.Parent.ScripterFrame.TextButton.Interactable = false
		script.Parent.Parent.Parent.JoinFrame.TextButton.Interactable = false
		script.Parent.Parent.Parent.GroupFrame.TextButton.Interactable = false
		script.Parent.Parent.Parent.TimeFrame1.TextButton.Interactable = false
		script.Parent.Parent.Parent.TimeFrame2.TextButton.Interactable = false
		script.Parent.Parent.Parent.TimeFrame3.TextButton.Interactable = false
		wait(4)
		script.Parent.Parent.Parent.GroupCheck.TextTransparency = 1
		script.Parent.Parent.Parent.BuilderFrame.TextButton.Interactable = true
		script.Parent.Parent.Parent.ScripterFrame.TextButton.Interactable = true
		script.Parent.Parent.Parent.JoinFrame.TextButton.Interactable = true
		script.Parent.Parent.Parent.GroupFrame.TextButton.Interactable = true
		script.Parent.Parent.Parent.TimeFrame1.TextButton.Interactable = true
		script.Parent.Parent.Parent.TimeFrame2.TextButton.Interactable = true
		script.Parent.Parent.Parent.TimeFrame3.TextButton.Interactable = true

	end

end)

I’m not really sure where to even start with this as I have tried as much as I can think of. ANY help at all, even if just an idea would be appreciated, thank you!

Just use server-client replication using remote events (use :FireServer() with your parameters, and use :FireAllClients() to replicate to everyone else)

1 Like

Could you elaborate further? Like what parameters I should send over and how my code should look after I use :FireAllClients()?

Best and quick and easy solution to fix your replication needs is to apply a tag if the user is in the group, for every player.

Here’s what I mean:

local function setupChatFormatting()
    TextChatService.OnIncomingMessage = function(message: TextChatMessage)
        local properties = Instance.new("TextChatMessageProperties")

        if message.TextSource then
            local player = Players:GetPlayerByUserId(message.TextSource.UserId)

            if player and player:IsInGroup(GroupId) then
                properties.PrefixText = "<font color='#ed379b'>[Patron]</font> " .. message.PrefixText
            end
        end

        return properties
    end
end

This would be on the same client script, and for added security you could verify group authenticity on the server using a RemoteFunction.

While I have considered this, this isn’t exactly what I had in mind. I want the player to be able to choose what tag they want with the inventory system I have set up. Thanks though.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.