please tell me how i can make a simulator click-detector it should add 1 point when holding an item... please help
1 | script.Parent.Equipped:Connect( function (mouse) |
2 | mouse.Button 1 Down:Connect( function () |
3 | print ( "clicked" ) |
4 | end ) |
5 | end ) |
I am shy to say the explaination.
The click detector is in a tool? or what?
simple, use the Activated event (reference here: https://developer.roblox.com/api-reference/event/Tool/Activated)
1 | local Tool = script.Parent; -- you should know how to modify this |
2 | Tool.Activated:Connect( function () |
3 | -- Example code: |
4 | print ( "Clicked" ); |
5 | end ); |
This will print "Clicked" once the tool has been activated (by pressing mouse 1). Reminder; this should be inside a LocalScript. You'll have to use RemoteEvents / RemoteFunctions to add points.