I need help with repeating until the player clicks

I am not sure how to achieve this sop any help is amazing

Here is my code:

repeat
	PlacingStructure:MoveTo(mouse.Hit.Position)
	wait()
until mouse.Button1Down

For some reason right when this function runs it instantly stops. Anyone know how to fix this?

1 Like

mouse.Button1Down is a bindable event, its not a boolean that tells when the mouse is or isn’t down.

1 Like

Do you have a solution on how I can make this work?

1 Like

i’m on school wifi so i’m unable to give the second solution to this currently, however the first one I can suggest is making a boolean variable for whether or not the mouse is held. on Button1Down or inputbegan/inputchanged set the variable to true. make your repeat loop’s base case until not button1Down have another function of inputended/inputchanged or Button1Up and set the variable to false
there is another solution that doesn’t require multiple functions but i do not have it memorized, i’ll add to this later when i am able to access my main computer.

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.