Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why doesn't this create the message?

Asked by 7 years ago
Edited 7 years ago
1game.Players.PlayerAdded:Connect(function(Player)
2    game:GetService("StarterGui"):SetCore("ChatMakeSystemMessage",{
3    Text = "[SERVER] "..Player.Name.." has joined the game!";
4    Color = Color3.new(0,1,0);
5    Font = Enum.Font.SourceSans;
6    FontSize = Enum.FontSize.Size24;
7})
8end)
0
This feature will only work in a LocalScript (or a ModuleScript running on the client) arshad145 392 — 7y

1 answer

Log in to vote
1
Answered by 7 years ago

Put it in a LocalScript, running on the client, use RemoteEvents if necessary, e.g.

1-- Client script
2game.Workspace:WaitForChild("MakeAChat").OnClientEvent:Connect(function(msg)
3game:GetService("StarterGui"):SetCore("ChatMakeSystemMessage",{
4    Text = "[SERVER]: " .. msg;
5    Color = Color3.new(0,1,0);
6    Font = Enum.Font.SourceSans;
7    FontSize = Enum.FontSize.Size24;
8})
9end)
1-- Server script
2local remote = Instance.new("RemoteEvent")
3remote.Parent = workspace
4remote.Name = "MakeAChat"
5game.Players.PlayerAdded:Connect(function(plr)
6     remote:FireClient(plr, "Why, hello there!") -- Only sends message to player
7     remote:FireAllClients(plr .. " has joined the game!") -- Sends message to everyone
8end)

The upside to this, is you can send a message to only one client at a time, or to everyone by using FireAllClients()

Reference

0
Nicely done. AdministratorReece 193 — 7y
Ad

Answer this question