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

Why aren't my system messages' FontSize changing?

Asked by 4 years ago
Edited 4 years ago

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)

1 answer

Log in to vote
1
Answered by 4 years ago

When in doubt, read the Wiki!

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)
0
I read the wiki about this and when i used TextSize and the enum the text was very small, pixels basically. I didnt know that an integer was a number thanks! Green_Lime2 80 — 4y
Ad

Answer this question