At output it's prints nil, instead of my name ingame. Here is the code:
1 | local playerToFind = hit.Parent.Name -- Hit is the way I find out what touched the brick. |
2 | local playerService = game:GetService( "Players" ) |
3 | local player = playerService:FindFirstChild(playerToFind) |
4 | print (player) |
I really have no idea why, I hope someone can help me. - Toby
The problem is that at line 4, you didn't convert the name of the player. You can just do:
1 | print (player.Name) |