Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 4 years ago

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

Log in to vote
0
Answered by 4 years ago

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.

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? AngryPlaayer 17 — 4y
0
You can just use RemoteEvent:FireAllClients(Player.Name) if you want the name to be shown to all clients on like a gui. Crafter215 -5 — 4y
Ad

Answer this question