How to wait until touch in a for loop

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? So i want to make a missile,That follow a bezier curve,Which has some part,I want it to use rocket propulsion to get from one part to another vai a for loop

  2. What is the issue? I don’t know how to loop through and wait until the missile come close to the proximity of each bezier curve node and i could not use Touched:Wait since,The part may touch anything else,That will delay until the part come close to the bezier node.And i don’t want estimation

local b = require(game.ServerScriptService.BezierCurve)
workspace.Util.Point.Position =     b.CalculatePoint(self,, -24.264, -1853.351),, -24.264, 782.699),{, 2740.106, -495.585),, 2740.106, -495.585)},0.25)
local lp = nil
local currentN= 0
local s =, -24.264, -1853.351)
local run = game["Run Service"]
for _,pos in pairs(b.Calculate(self,, -24.264, -1853.351),, -24.264, 782.699),20,{, 2740.106, -495.585)})) do
	local cp ="Part")
	currentN += 1
	cp.Parent = workspace.Util.curveParts
	cp.Anchored = true
	cp.CanCollide = false
	cp.Name = tostring(currentN)
	if lp then
		cp.Size =,0.2,(lp-pos).Magnitude)
		cp.CFrame =,pos)
		cp.Size =,0.2,(s-pos).Magnitude)
		cp.CFrame =,pos)
	lp = pos

1 Like

If you want to wait before the rocket touches a particular object, you can use an :IsA() inside the touched function.

No it wont work since its just checking if the part is something,But if its not its gonna just skip and go through the next part which i dont want.

I don’t think this is the best method, I think you should base it off of proximity. However, I think this will answer your question.

local touch
repeat touch = cp.Touched:Wait() until touch.Name == "Node" -- idk how you identify the nodes, identify it after 'until'