Hello. I was trying to make a script that would create a message whenever a new player joins the game, but it seems to not work. The output shows this error: "Workspace.Welcome Note:5: attempt to index nil with 'Name' ". I have no idea on how to fix this. Help?
local Players = game:GetService("Players")
function onPlayerAdded(player)
local message = Instance.new("Message", game.Workspace)
message.Text = player.Name.. " has entered the game" --Error here.
wait(5)
message.Parent = nil
end
Players.ChildAdded:Connect(onPlayerAdded())

1 comment
Thank you, Tyler!