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

What is the parameter at the end of the event ClickDetector for how many times they clicked?

Asked by 5 years ago

I want to know what goes at the end of a MouseClick so I can see how many times they clicked. It didn't work this way ~~~~~~~~~~~~~~~~~ game.Workspace.Part.ClickDetector.MouseClick:Connect(function(click) ~~~~~~~~~~~~~~~~~

1 answer

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

ClickDetector#MouseClick returns the player instance of who clicked it, not the number of times the ClickDetector has been clicked. You can record this though! Let's create an instance that can log it.

Create an IntValue and set it's parent to the ClickDetector, and name it to "Clicks". Now we will reference it in the script and add on the clicks.

game.Workspace.Part.ClickDetector.MouseClick:Connect(function(player)
    ClickDetector.Clicks.Value = ClickDetector.Clicks.Value + 1
end) 

If you want to get the amount of times it has been clicked, then you can get the value of the IntValue.

Ad

Answer this question