I thought this would be easy and made it very quickly but found that it didnt work. So , I tested it alot of times to see if there is a mistake but in the end I just couldnt find it even after I tried.
So if anyone knows whats wrong with my script please explain to me. Help would be appreciated! Thanks.
This script is to get the players name.
local plr = game:GetService("Players").LocalPlayer
local name = plr.Name
print(name)
it just gives me this error and idk how to fix 17:25:22.297 - Workspace.Script:2: attempt to index nil with 'Name' 17:25:22.297 - Stack Begin 17:25:22.298 - Script 'Workspace.Script', Line 2 17:25:22.298 - Stack End

2 comments
Yes, and that is a comment, use answer when u explain how to do it
I tried playeradded and waitforchild but it doesnt work