Can you use an action(ex. MouseButton1Click
) in an if statement?[in many ways]
Not only
~~if script.Parent.MouseButton1Click then~~ a wrong example
IN MANY WAYS
You can wait for an event to happen or run a function when the event occurs. Using an event in a statement doesn't make any sense.
To wait for an event you can do Event:Wait()
instead of Event:Connect(function)
You could also check if the mouse is down in your if statement by putting it in a variable
local Mouse = game.Players.LocalPlayer:GetMouse() local MouseDown = false Mouse.Button1Down:Connect(function() MouseDown = true end) Mouse.Button1Up:Connect(function() MouseDown = false end) --somewhere in ur code if MouseDown then