Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Getting a Players name

I have been working on a GUI system where you can order things from a shop. Real users (Cashiers) run the shop and players can purchase things and when they finish ordering.. It will send the data to a cashier with there order and there username.

I have gotten everything else down like knowing how to send data to other players and change their data in their GUIs and stuff.

However the only thing I don't know how to do is get the player's username that clicked the GUI button.

No, I am not looking for full length scripts or anything just a detailed explanation and what I should do. I already have the scripts needed to do this I just need the method in getting the players username

I have experimented with getting the players name through touched functions but that sadly won't work...

So to sum everything up, How do I get the players username that clicked the GUI button. And return it to them in a text label?

1 answer

✓ Accepted answer

make a local script for the shop then get the LocalPlayer

EX.

local Player = game.Players.LocalPlayer
print(Player.Name) -- prints Player Name

get all players name

EX.

for i, Player in pairs(game.Players:GetChildren()) do
	print(Player.Name)
end

1 comment

0

Thanks!

This discussion is preserved as it was. New answers, comments, and votes are closed.