The problem is that you are not using a local script. LocalPlayer
can only be accessed in a local script. You will have to go about this in another way. I'm not sure how you are going to choose whos name you want to display, but here is a script that will display the name of the most recent player to join:
1 | game.Players.PlayerAdded:Connect( function (plr) |
2 | script.Parent.Text = ( "Thanks to " .. plr.Name.. " for playing the game!" ) |
Hope that helped, if you want it to work differently leave a comment and I'll see what I can do.