Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

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 :/

This discussion is preserved as it was. New answers, comments, and votes are closed.