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

How do you check which player clicked a TextButton on a SurfaceGUI?

I'm working on an update for my game, the Aethership, and i've run into a problem with a new feature: i want to make it to where you can enter a place id in your ScreenGUI, then click on a button in the SurfaceGUI on the ship's console to teleport there, but i can't seem to find a way to check which player clicked the button so the game can import the place id from their local ScreenGUI.

1 answer

✓ Accepted answer

Here is my workaround, note that I have supplied just as much code as you.

Do not have any server copies of the SurfaceGui, create one for each client once they join the game(or Clone it from ReplicatedStorage), and detect if it is clicked through a LocalScript in StarterPlayerScripts.

This way, the event will be triggered individually for each LocalPlayer. At that point, you can use the RemoteEvent:FireServer() method to let the server know who is teleporting, and to where.

6 comments

0

Wow, great explanation!

0

Here's the thing: i don't want to teleport players individually, everyone on the server is supposed to teleport, so i need it to teleport everyone to the location specified by the player who clicked the button, i apologize if my original post didn't make this clear.

0

And as for me not supplying any code, i don't really have much of a place to start with writing the code, since i can't find any documentation for this vital element.

0

Needing to teleport everyone doesn't change what you would do much at all. Whenever you fire server, at that point you already know who or

0

Who pressed it and what they typed, do on the server just iterate through a table of players and teleport them all to the location given.

0

I think i might have just found a simpler solution, but i'll keep yours in mind if i run into a similar problem, so thanks anyway.

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