Help with launching objects with velocity

I am currently working on an ATM robbery type system, and I need to money to actually eject out instead of stack in one part, but in not exactly sure how to do it
-code

local ejected = false
local bill = game.ReplicatedStorage.Bill

local function eject()
	local Bill = bill:Clone()
	Bill.Parent = workspace
	Bill.Position = script.Parent.EjectPos.Position
	
	local Bill2 = bill:Clone()
	Bill2.Parent = workspace
	Bill2.Position = script.Parent.EjectPos.Position
	
	local Bill3 = bill:Clone()
	Bill3.Parent = workspace
	Bill3.Position = script.Parent.EjectPos.Position
	
	local Bill4 = bill:Clone()
	Bill4.Parent = workspace
	Bill4.Position = script.Parent.EjectPos.Position
	
	local Bill5 = bill:Clone()
	Bill5.Parent = workspace
	Bill5.Position = script.Parent.EjectPos.Position
end

while true do
	if script.Parent.Humanoid.Health <= 0 then
		if ejected == true then
			print("wait for the cool don")
		else
			print("eject")

			eject()

			ejected = true
		end
	end
	wait()
end

Instead of doing it 5 times, you can use a for loop. Something like:
for i = 1, 5 do
local Bill = bill:Clone()
Bill.Parent = workspace
Bill.Position = script.Parent.EjectPos.Position
end

Also to eject the parts, you can potentially to use the lookVector of ATM, depend how he is placed.

1 Like

Or he could add a part with the front face facing where he wants it to eject and make the part transparent.

thats what I have, but they all just stack up and fall in a stack

EjectPos is the part which eject or supposed to?

You can add a body velocity for every part and just do:
BodyVelocity.Velocity = EjectPost.CFrame.lookVector*100

1 Like

It would be something like this

1 Like

So you want them not to eject at the same time? Or do you want to launch eject them to fall at the same time?