I’m trying to make a System Message when a player dies, using there display name and if they don’t have one then for the message to use there username.
It works fine without trying to use there display name for the death message, but once I tried doing it with a display name it just won’t make the message at all.
local function welcome(playerName)
i = " died"
local name = {}
if playerName.DisplayName ~= nil then
name = playerName
elseif playerName.DisplayName == nil then
name = playerName.DisplayName
end
game.StarterGui:SetCore('ChatMakeSystemMessage', {
Text = name.DisplayName..i;
Font = Enum.Font.SourceSansBold;
Color = textColor.Color;
FontSize = Enum.FontSize.Size24;
})
end
end
remoteEvent.OnClientEvent:Connect(welcome)