Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
0

Getting a Players name

Asked by 5 years ago

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

Log in to vote
2
Answered by 5 years ago

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
0
Thanks! IntellectualBeing 425 — 5y
Ad

Answer this question