Server message not appearing for everyone in the server?

I am trying to get the server to send a message to the chat that someone has unboxed something.

But… come to find out it only sends a message for the player.

-- Server script:
Remotes.ShowChatItemUnboxed:FireAllClients({
	Text = "[Server]: "..Player.Name.." has unboxed ["..ItemModule.GetRarity(ChosenItem).."] ".. ItemModule.GetInfo(ChosenItem).."!";
	Color = ItemModule.GetRarityColor(ChosenItem);
	Font = Enum.Font.SourceSansBold;
	FontSize = Enum.FontSize.Size24
})

--Local:
Remotes.ShowChatItemUnboxed.OnClientEvent:Connect(function(chatProperties)
	game:GetService("StarterGui"):SetCore("ChatMakeSystemMessage", chatProperties)
end) 

I also tried getting players…

for i, v in pairs(game.Players:GetPlayers()) do
   Remotes.ShowChatItemUnboxed:FireClient(v, {
		Text = "[Server]: "..Player.Name.." has unboxed ["..ItemModule.GetRarity(ChosenItem).."] ".. ItemModule.GetInfo(ChosenItem).."!";
		Color = ItemModule.GetRarityColor(ChosenItem);
		Font = Enum.Font.SourceSansBold;
		FontSize = Enum.FontSize.Size24
	})
end

Is there anything I could do? Thank you in advanced.

1 Like
Remotes.ShowChatItemUnboxed:FireAllClients({
	Text = "[Server]: "..Player.Name.." has unboxed ["..ItemModule.GetRarity(ChosenItem).."] ".. ItemModule.GetInfo(ChosenItem).."!";
	Color = ItemModule.GetRarityColor(ChosenItem);
	Font = Enum.Font.SourceSansBold;
	FontSize = Enum.FontSize.Size24
})

Notice the ;'s, you are supposed to have commas, here is the right code:

Remotes.ShowChatItemUnboxed:FireAllClients({
	Text = "[Server]: "..Player.Name.." has unboxed ["..ItemModule.GetRarity(ChosenItem).."] ".. ItemModule.GetInfo(ChosenItem).."!",
	Color = ItemModule.GetRarityColor(ChosenItem),
	Font = Enum.Font.SourceSansBold,
	FontSize = Enum.FontSize.Size24
})

Well, that doesnt make a difference :man_shrugging:,
I was really looking on how I could send a message (not to the player localally), but through the server (which everyone could see the message.)

Ok, so what if you pass the title, and color on the server?

Well, you cant really do SetCore through server, thats only localally.

No, I mean you pass the title, and color event IN the event…

Yeah it works, but still isnt sending to everyone, just that player.

PLAYER 2: -------------------------------------- PLAYER 1:
Screenshot (814)

Wait I think I know what the problem is…

I finally fixed it! It was only because I had put this event inside of another event which was fired for only that player.

2 Likes

Good deal, happy you found the solution!

1 Like

I’d like to point you towards a different way of doing this, if I could.

Introducing the Lua Chat System, which has an absolutely amazing range of customisability and features. With a little bit more hard work, you would be able to obtain this same thing (or better) while keeping the message sending all on the server. Some benefits:

  • You don’t need to maintain a server-client message sender on your own
  • Don’t have to rely on the unpredictability of SetCore and its registry
  • Potentially easier to do after learning the concepts
  • Canonically correct (afaik this supersedes ChatMakeSystemMessage)

The LCS can create a bot chat speaker so we can have it send out a message as if it were like a regular player. You could even change the name colour if you want. For the sake of keeping things consistent, I’ll keep the name and chat colours the same.

-- This would be near the top with all your declarations and whatnot
local ChatService = require(game:GetService("ServerScriptService"):WaitForChild("ChatServiceRunner").ChatService)

local DEFAULT_CHANNEL = "All"
local UNBOX_MESSAGE = "%s has unboxed [%s] %s!"

local serverSpeaker = ChatService:AddSpeaker("Server")

-- This part would be where you send the message
local rarity = ItemModule.GetRarity(ChosenItem)
local rarityColor = ItemModule.GetRarityColor(ChosenItem)
local info = ItemModule.GetInfo(ChosenItem)

-- I don't know if there are font ExtraData keys, but try to stay away from them
-- Larger chats consume more chat space, are spammy and are annoying to read
serverSpeaker:SayMessage(UNBOX_MESSAGE:format(Player.Name, rarity, info), "All", {
    NameColor = rarityColor,
    ChatColor = rarityColor
})
4 Likes