How can I get player’s name when player clicked button?
1 Like
You don’t need a button, you can simply do this:
local Players = game.Players
local Player = Players.LocalPlayer
local PlayerName = Player.Name -- You can also do Player.DisplayName
2 Likes
Oh, Yeah I was acting dumb, Thanks.
1 Like
Make sure to check my post as a solution so people no longer need to reply!
1 Like
Yeah, I’m gonna try it and If it works I wil
1 Like
Is only works In local script right?
Yep, only LocalScripts in GUI’s
1 Like
If it’s a severscript for whatever reason, simply keep doing Instance.Parent until you reach the player.
I guess It’s working, but I have some problem.
It works! thanks for your helping
You’re welcome! Helping out the community is my favorite thing to do.
1 Like
script:FindFirstAncestorOfClass("Player")
But that’s only going to work for scripts which are a descendant of the player to begin with, that wouldn’t work for scrips inside the ServerScriptService container/workspace etc.
2 Likes