Use ``` to wrap your code rather >. Also NameChanged isn’t an event for Player. Did you mean smth like this?
local welcomeLabel = Workspace.Cartel.SurfaceGui.TextLabel
local function updateWelcomeMessage(playerName)
local welcomeMessage = "Welcome " … playerName
welcomeLabel.Text = welcomeMessage
end
end
updateWelcomeMessage(game.Players.LocalPlayer.DisplayName)
local welcomeLabel = workspace:WaitForChild("Cartel").SurfaceGui.TextLabel
local function updateWelcomeMessage(playerName)
local welcomeMessage = "Welcome " … playerName
welcomeLabel.Text = welcomeMessage
end
updateWelcomeMessage(game.Players.LocalPlayer.DisplayName)
local Players = game:GetService("Players")
local welcomeLabel = workspace.Cartel.SurfaceGui.TextLabel
local function updateWelcomeMessage(playerName)
local welcomeMessage = "Welcome "..playerName
welcomeLabel.Text = welcomeMessage
end
Players.PlayerAdded:Connect(function(plr)
updateWelcomeMessage(plr.Name)
end)