Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How would you send a message to the chat globally?

game:GetService("StarterGui"):SetCore("SendNotification",{
	Text = "test";
	Title = "test";
	Color = Color3.new(0,1,1)
	})

So I've been told that SendNotification is an API, but it hasn't been developed yet.

game:GetService("StarterGui"):SetCore("ChatMakeSystemMessage",{
	Text = "Welcome, "..player.Name..".";
	Color = Color3.new(0,1,1)
})

However, there is ChatMakeSystemMessage, which is working. The problem I am running into is that I want it to display globally, meaning that every user can see the message, rather than just the LocalPlayer.

For those of you who don't know, the script has to be a LocalScript & located in the StarterGui. Help would be appreciated.

2 answers

✓ Accepted answer

I would use RemoteEvents for this. When you have a RemoteEvent all you do is call FireAllClients() and the same thing happens to everyone.

LocalScript in StarterGui:

local plr	= game.Players.LocalPlayer
local RE	= Instance.new("RemoteEvent", game.ReplicatedStorage)
RE.Name	= "Chat"
RE.OnClientEvent:connect(function(msg, color)
	game:GetService("StarterGui"):SetCore("ChatMakeSystemMessage", {
		Text = msg or "Hello, world!";
		Color = color or Color3.new(0, 1, 1)
	})
end)

Script in ServerScriptService:

local RE	= game.ReplicatedStorage:WaitForChild("Chat")


-- welcome message
game.Players.PlayerAdded:connect(function(plr)
	RE:FireAllClients(plr.Name.." has joined the server.", Color3.new(0, 1, 0));
end)

game.Players.PlayerRemoving:connect(function(plr)
	RE:FireAllClients(plr.Name.." has left the server.", Color3.new(1, 0, 0);
end)

-- general information messages
local info = {"fav the game!", "thumb up the game pls!", "follow my twitter!"}

while true do
	for i,v in next, info do
		RE:FireAllClients(v, Color3.new(BrickColor.Random().Color))
		wait(15)
	end
end

8 comments

0

Well apart from the last bit completely spamming the chat & crashing the server, it didn't work.

0

Oops I forgot to put a wait(), there, now try it.

0

Unfortunately, it's still not working. I mean, the general information part is, however the introduction message is not.

0

Now try the new script

0

Still not working.

0

Works for me.

0

The general information works, sure, but the introduction message does not.

0

The join message works for me lol

This method might be a bit barbarian, but it should work:

Put a StringValue named "Chat" in Workspace. Put this LocalScript in every Player.

ChatValue = game.Workspace.Chat

Chat.Changed:connect(function(property)
	game:GetService("StarterGui"):SetCore("ChatMakeSystemMessage", {
        Text = Chat.Value;
        Color = color or Color3.new(0, 1, 1)})
end)

And then have this Script in workspace too:

game.Players.PlayerAdded:connect(function(player)
	game.Workspace.Chat.Value = "Welcome, "..player.Name
end)

I might have made me a mistake, if so, please contact me. If you'd need any further explanation, feel free to contact me too.

P.S. Please UpVote, so I can Upvote others! (I don't have 5 Rep yet)

This discussion is preserved as it was. New answers, comments, and votes are closed.