Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do you make a particle emitter for parts?

Hello, I am stuck on finding a way to make a part generate from an area then go to a certain point then destroy. Kind of like a particle emitter accept it's with parts and the part is always spawning moving to and destroying at the same spot. This would be going on forever

Here is what I've sort of come up with so far.


while true do
	local TweenService = game:GetService("TweenService")
	 
	while true -- making the parts that will be generated
		local part = Instance.new("Part")
		part.Position = Vector3.new(0, 10, 0)
		part.Color = Color3.new(1, 0, 0)
		part.Anchored = true
		part.Parent = game.Workspace
		wait(2)
	do
	
	 
	local goal = {}
	goal.Position = Vector3.new(10, 10, 0)
	goal.Color = Color3.new(0, 1, 0)
	 
	local tweenInfo = TweenInfo.new(5)
	 
	local tween = TweenService:Create(part, tweenInfo, goal)
	 
	tween:Play()
	part:Destroy() -- Destroy the part after it has reached the desired location
end

1 answer

✓ Accepted answer

you're destroying the part before it reaches the goal point

while true do
    local TweenService = game:GetService("TweenService")

    while true -- making the parts that will be generated
        local part = Instance.new("Part")
        part.Position = Vector3.new(0, 10, 0)
        part.Color = Color3.new(1, 0, 0)
        part.Anchored = true
        part.Parent = game.Workspace
        wait(2)
    do


    local goal = {}
    goal.Position = Vector3.new(10, 10, 0)
    goal.Color = Color3.new(0, 1, 0)

    local tweenInfo = TweenInfo.new(5)

    local tween = TweenService:Create(part, tweenInfo, goal)

    tween:Play()
    tween.Completed:Wait() -- waits until the tween is completed
    part:Destroy() -- Destroy the part after it has reached the desired location
end

This discussion is preserved as it was. New answers, comments, and votes are closed.