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

Can you use Mouse.Button1Down in a while true loop?

Asked by 5 years ago
Edited 5 years ago

Im making a loop where it changes a parts position constantly until you click. However the click function happpens without me even clicking. Dont know why it does that.

Code looks something like this

Completed = false

while true do
    (Lots of other code here)
    while Completed == false do
        wait(.05)
        Mouse.Button1Down:connect(function()
            print("Mouse was clicked")
        end)
    end
end

Summary: While loop runs function even thought the mouse wasn't clicked. Any fixes?

0
try moving line 5 and 6 on line 10. A1exTatum 57 — 5y

Answer this question