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

Why doesn't this create the message?

game.Players.PlayerAdded:Connect(function(Player)
	game:GetService("StarterGui"):SetCore("ChatMakeSystemMessage",{
    Text = "[SERVER] "..Player.Name.." has joined the game!";
    Color = Color3.new(0,1,0);
    Font = Enum.Font.SourceSans;
    FontSize = Enum.FontSize.Size24;
})
end)

2 comments

0

This feature will only work in a LocalScript (or a ModuleScript running on the client)

1 answer

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

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

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

Reference

1 comment

0

Nicely done.

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