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

How to get name of player when pressing a button for normal (not local) script??

I’m trying to make a button that gets the name of a player who pressed a button and show it to everyone in the server, so it appears like “AngryPlaayer is hosting a sword fight!” Or something. Do i need to do something like script.Parent.MouseButton1Click:Connect(function(player) or something like that? And then i know how to do everything else it sends the person who sent the client event’s name. Please tell me you guys understand what im saying lol

1 answer

Why not run the clicked detection client side, then fire the server using remote events. The first parameter of a remote event (client -server) is the player. From there, if the message pops up via ui, just tell every client that "AngryPlaayer is hosting a sword fight!". If the message is through chat, have the server handle that.

2 comments

0

It will show up on a text label. How do i take localplayer’s name from a localscript and carry that name to the server script to then show that name to all clients?

0

You can just use RemoteEvent:FireAllClients(Player.Name) if you want the name to be shown to all clients on like a gui.

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