So I'm making a button where you can start a 60 second countdown and to prevent people abusing this button, I want to make a log on the screen saying "(player) has started a countdown!) ((player) being the player who started the timer's name.) I don't know how to do this and I can't just do Players.LocalPlayer because it's a normal script not a local one. I have everything else done i just want this now. I don't want it as a local script because I want everyone to see who started the timer. Plz someone help
COMMUNITY QUESTION
How do I get the name of the player who clicked a button with a normal script?
1 answer
The first parameter (and probably only) of the MouseClick event is the player who clicked it. Here is a script that will print the player name of the person who clicked it:
local cd = script.Parent --change to where the click detector would be
function onClicked(plr)
print(plr.Name)
end
cd.MouseClick:Connect(onClicked)
1 comment
0
It’s not a click detector. Ok since i made this question I’ve changed lots of things. Basically you click the button and on a normal script it fires on all clients making a text label that says “player has started a sword fight” or “player has started a countdown”. Even if i knew how to get the player’s name from the normal script i wouldnt know how to take that name to the local script
This discussion is preserved as it was. New answers, comments, and votes are closed.

3 comments
MouseClick's first parameter is the player who clicked, so you can do .Name ( is the parameter name)
Are you using a textbutton or a clickdetector?
Text button. It then fires on all clients with the name of the person who clicked the button