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

How do i make a click-detector for a simulator?

Asked by 4 years ago

please tell me how i can make a simulator click-detector it should add 1 point when holding an item... please help

3 answers

Log in to vote
0
Answered by 4 years ago
script.Parent.Equipped:Connect(function(mouse)
    mouse.Button1Down:Connect(function()
        print ("clicked")
    end)
end)

I am shy to say the explaination.

0
I guess I will, then. hoyhyo 2 — 4y
0
The script will basically turn on when you equip the tool. After this happens, if you click it will say clicked in the output. hoyhyo 2 — 4y
0
so i need to put the script in a localscript? and the localscript in the tool? sinbadxfan05 3 — 4y
Ad
Log in to vote
0
Answered by
gloveshun 119
4 years ago

The click detector is in a tool? or what?

0
I think so he mentioned tool. antoniorigo4 117 — 4y
Log in to vote
0
Answered by 4 years ago

simple, use the Activated event (reference here: https://developer.roblox.com/api-reference/event/Tool/Activated)

local Tool = script.Parent; -- you should know how to modify this
Tool.Activated:Connect(function()
    -- Example code:
    print("Clicked");
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.

Answer this question