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

How to detect the player is clicking & holding ?

Asked by 4 years ago

So i have a gui button and i want to create a easter egg function by clicking and holding it for 2 second This is a script i currently have in my mind

script.Parent.MouseButton1Down:Connect(function()
if script.Parent.MouseButton1Up then
else
wait(3)
--Secret function
end
end)

Idk if that works. Is there a better way of doing this ? Thanks for reading, hope you could help :D

1 answer

Log in to vote
1
Answered by 4 years ago
script.Parent.MouseButton1Down:Connect(function()
    local isholding = true
    script.Parent.MouseButton1Up:Connect(function()
        isholding = false
    end)
    wait()
    if isholding then
        --Secret Function
    end
end)
0
Oh i will try it out, thanks ! (I will accept if it works) Nguyenlegiahung 1091 — 4y
Ad

Answer this question