I have code that will send a system message in the chat about who the player is and if they joined or left.
The issue:
I used FireAllClients on the server script and in the chat, it didn't say that I joined the game or anything.
A little help? Thanks!
Server Script:
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RemoteEvent = ReplicatedStorage:WaitForChild("PlayerJoinedorRemoved")
Players.PlayerAdded:Connect(function(playerAdded)
RemoteEvent:FireAllClients(playerAdded,"Joined")
end)
Players.PlayerRemoving:Connect(function(playerRemoved)
RemoteEvent:FireAllClients(playerRemoved,"Left")
end)
Local Script:
local StarterGui = game:GetService("StarterGui")
local Players = game:GetService("Players")
local Player = Players.LocalPlayer
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RemoteEvent = ReplicatedStorage:WaitForChild("PlayerJoinedorRemoved")
RemoteEvent.OnClientEvent:Connect(function(action)
if action == "Joined" then
game.StarterGui:SetCore("ChatMakeSystemMessage", {
Text = (Player.Name.." has joined the server.");
Color = Color3.fromRGB(121, 255, 188);
Font = Enum.Font.ArialBold;
})
elseif action == "Left" then
game.StarterGui:SetCore("ChatMakeSystemMessage", {
Text = (Player.Name.." has left the server.");
Color = Color3.fromRGB(255, 51, 71);
Font = Enum.Font.ArialBold;
})
end
end)

1 comment
instead of using playertodisplay.Name you can instead just send the player's name as an argument and you can also set that entire table of arguments in the localscript to an argument in the script