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

how do I see if someone pressed a key or clicked twice?

Asked by 5 years ago

I am making a game where it requires the player to click twice? How do i do this?

script.Parent.ClickDetector.MouseClick:Connect(function(player)
if script.Parent.ClickDetector.MouseClick:Connect(function(player) then
print (5)
end)
end)

Please help!

1 answer

Log in to vote
0
Answered by 5 years ago

You could probably get away with a single mouse click, but if you do need double click then you can do this:

local clicks = 0
script.Parent.ClickDetector.MouseClick:Connect(function(player)
    clicks = clicks + 1
    if clicks >= 2 then
        --put here what you need
        clicks = 0 
    end
end)

Should work.

0
THANK YOU SO MUCH!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! turquoise_monkeyman 32 — 5y
0
Is it possible to do it with keys turquoise_monkeyman 32 — 5y
0
It is possible, but it's more difficult! JustaLatvian 30 — 5y
0
Ok you don't need to but thank you turquoise_monkeyman 32 — 5y
Ad

Answer this question