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

Why is my chat message script not working and how can i fix it?

Asked by 3 years ago
local StarterGui = game:GetService("StarterGui")
local players = game:GetService('Players')

local function teamChanged(player)
    player:GetPropertyChangedSignal('Team'):Connect(function()
        wait()
        local Success = pcall(function()
            StarterGui:SetCore("ChatMakeSystemMessage", 
                {
                    Text = player.Name .. ' has progressed to ' .. player.Team.Name,'All'; --The chat message
                    Color = player.Team.TeamColor.Color; --Chat message color, defaults to white
                    Font = Enum.Font.SourceSansBold; --Chat message font, defaults to SourceSansBold
                    TextSize = 18 --Text size, defaults to 18

            })
        end)
    end)
end

players.PlayerAdded:Connect(teamChanged)

for _, player in pairs(players:GetPlayers()) do
    teamChanged(player)
end

I have placed it in StarterGui as localScript and no errors occur.

Answer this question