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

Checking if the mouse button is pressed in a if statement?

Asked by 5 years ago

Using

mouse.Button1Down:Connect(function()

only fires when the button is pressed, how would I make it turn into a if statement?

if mouse.Button1Down then does not work.

1 answer

Log in to vote
0
Answered by 5 years ago

I believe it needs to be in a function. If you do

function onClick() if onClick then

print("Hello" else print("Not Hello")

end end

script.Parent.MouseButton1Click:Connect(onClick)

it prints 'Hello'. That means it does check if onClick has been fired but it has been wrapped in a function :/

Ad

Answer this question