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

How can you check who clicked a button?

Asked by 8 years ago

So I made a money system, and i made so you start with 100 dollars, and 5 dollars income every 3 seconds. I want it so that with a press of a button I can make the value of income change, but only for that player. Any idea how to do it? (Basically how to check who clicked the button)

1 answer

Log in to vote
1
Answered by 8 years ago
Edited 8 years ago

well make it try checking like umm if you have a "String Value" for your tycoon where that string value putted who owns that tycoon.. then do a script like this, well this is what I recommend you doing

put a string value in the model where your script is in, that string value will serve to know the player who owns the tycoon you get me? so to do that put in that string value the name of the player in the value located in the properties of the string value, then do this script to know who clicked the button is the player


function onClick(clr) local owner = script.Parent.Value if clr.Name == owner.Value then print("The owner") end end script.Parent.Part.ClickDetector.MouseClick:connect(onClick)
Ad

Answer this question