For loop troubles

I’m trying to make an attack that shoots 3 different projectiles where the mouse is currently aiming
to do this I’m using a for loop to repeat the steps in making one projectile and having it go 3 times.
image

The issue I’m running into is the Projectiles fire where the mouse was on the first click, if you move your cursor after you use the tool it’ll still shoot towards where the cursor was originally, I want it to check where the mouse is each time but I’m not sure how to do this I just recently learned how to use mouse Aiming with projectiles.

I’m using BodyVelocity to move the projectile
image

MouseAim is constant once it is sent to the server. You would need to fire the event to the server three separate times, that way MouseAim is updated.

If you want another solution, you could try doing a linear interpolation of the original MouseAim through whatever direction you decide is better, or, collect three different Mouse Positions and then firing them to the server once (this would require three mouse positions to be given before the first fireball actually fires, though.)

Firing the event 3 times works for the aiming but it also makes the fireballs shoot 9 times which is to be expected. I’ll have to play around with the script a bit more to get what I want but thank you for the help :smiley:

I assume you meant that the 9 fireball shoots is not intended. Just get rid of the for loop.

1 Like

It was actually a much easier fix than I thought, I just had to remove the for loop from the server script to get it to work :sweat_smile:

1 Like