Hello all, I have some code that is supposed to send a system message in the chat about who the player is and if they joined or left.
Now, the FontSize in the OnClientEvent
in the LocalScript isn't changing. I know that the default value is 18, but I set it to Size12 on Line 13 and it didn't change the size.
Is this because of the parameters or the arguments or something?
LocalScript:
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(playerToDisplay,action) if action == "Joined" then game.StarterGui:SetCore("ChatMakeSystemMessage", { Text = ("[SYSTEM] "..playerToDisplay.Name.." has joined the server."); Color = Color3.fromRGB(97, 255, 142); Font = Enum.Font.SourceSansBold; FontSize = Enum.FontSize.Size12 }) elseif action == "Left" then game.StarterGui:SetCore("ChatMakeSystemMessage", { Text = ("[SYSTEM] "..playerToDisplay.Name.." has left the server."); Color = Color3.fromRGB(255, 51, 71); Font = Enum.Font.SourceSansBold; FontSize = Enum.FontSize.Size12 }) end end)
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)
First, the name of the fourth table entry for :SetCore("ChatMakeSystemMessage"){}
is not FontSize
. Instead, it is TextSize
. Next, the value accepted for this entry is not the enum values for FontSize
. Instead, it is an integer. Here is the fixed code, and, again, please read the wiki when in doubt. It can solve most of your issues before you ever have to come here!
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(playerToDisplay,action) if action == "Joined" then game.StarterGui:SetCore("ChatMakeSystemMessage", { Text = ("[SYSTEM] "..playerToDisplay.Name.." has joined the server."); Color = Color3.fromRGB(97, 255, 142); Font = Enum.Font.SourceSansBold; TextSize = 12 }) elseif action == "Left" then game.StarterGui:SetCore("ChatMakeSystemMessage", { Text = ("[SYSTEM] "..playerToDisplay.Name.." has left the server."); Color = Color3.fromRGB(255, 51, 71); Font = Enum.Font.SourceSansBold; TextSize = 12 }) end end)