This code isn't working:
1 | if key_code = = 13 then |
2 | game.Players.PlayerAdded:connect( function (Player) |
3 | game.Workspace.Billboard.Screen.Front.Label 1. Text = Player.Name.. " pressed the button" |
4 | end ) |
I'm getting this error: "attempt to index field 'Name' (a string value)"
I'm pretty sure this code is really messed up but I just want it to say "[Player name] pressed the button" when a player presses key code 13.
First of all, your code makes no sense at all. PlayerAdded is for when a player joins the game, so your code would never even work. I have changed your code to work.
1 | local player = game.Players.LocalPlayer |
2 | if key_code = = 13 then |
3 | game.Workspace.Billboard.Screen.Front.Label 1. Text = player.Name .. " pressed the button." |
4 | end |