Advertisement
IHATEMICROWAVEOVEN

example2

Sep 27th, 2021
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.72 KB | None | 0 0
  1. -- This one, I will be simply making four projectiles shoot from
  2. -- around the boss. Right, backwards, left, forward, in that
  3. -- order. (This will be done using a "for" loop)
  4.  
  5. local cooolerprojectileO = game.ServerStorage.Items.SickProjecitle
  6. -- This does not actually exist in the game's code. I assume that
  7. -- I have a cool projectile with ideal traits, such as CanCollide
  8. -- set to false, Anchored set to false, etc., just for example.
  9.  
  10. function Use(...)
  11. local args = {...}
  12. for i = 1,4 do
  13. local coolerprojectile = cooolerprojectileO:Clone()
  14. coolerprojectile.Parent = game.Workspace
  15.  
  16. coolerprojectile.CFrame = args[1].CFrame
  17. -- We want the projectile to align with the boss, since it
  18. -- will shoot from the boss.
  19.  
  20. coolerprojectile.CFrame = coolerprojectile.CFrame * CFrame.Angles(0,math.rad(i*90),0)
  21. -- The projectile is rotated 90 degrees clockwise. Depending
  22. -- on which projectile number it is, the rotation will be
  23. -- more "extreme". It forms a + (plus) shape if you take an
  24. -- image of when they all spawn.
  25. -- (first at 90 deg, second at 180 deg, third at 270 deg, fourth at 360 deg aka 0 deg)
  26.  
  27. local bv = Instance.new("BodyVelocity", awesomeprojectile)
  28. bv.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
  29. bv.Velocity = coolerprojectile.CFrame.lookVector * 50
  30. -- Velocity shenans. You may notice that we use CFrame.lookVector!
  31. -- CFrame.lookVector is the direction that the CFrame is facing in,
  32. -- and it is exactly 1 stud in magnitude (basically "length").
  33. -- If you multiply it by 90 then it will be a vector that
  34. -- extends 90 studs in the direction that the subject is facing!
  35. -- This makes the projectile travel forward at 90 studs per second.
  36. end
  37. end
  38.  
  39. return Use
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement