You can write your topic however you want, but you need to answer these questions:
-
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
-
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,Vector3.new(-10.276, -24.264, -1853.351),Vector3.new(-2574.721, -24.264, 782.699),{Vector3.new(-1285.927, 2740.106, -495.585),Vector3.new(-1300, 2740.106, -495.585)},0.25)
local lp = nil
local currentN= 0
local s = Vector3.new(-10.276, -24.264, -1853.351)
local run = game["Run Service"]
for _,pos in pairs(b.Calculate(self,Vector3.new(-10.276, -24.264, -1853.351),Vector3.new(-2574.721, -24.264, 782.699),20,{Vector3.new(-1285.927, 2740.106, -495.585)})) do
local cp = Instance.new("Part")
currentN += 1
cp.Parent = workspace.Util.curveParts
cp.Anchored = true
cp.CanCollide = false
cp.Name = tostring(currentN)
if lp then
cp.Size = Vector3.new(0.2,0.2,(lp-pos).Magnitude)
cp.CFrame = CFrame.new((lp+pos)/2,pos)
else
cp.Size = Vector3.new(0.2,0.2,(s-pos).Magnitude)
cp.CFrame = CFrame.new((s+pos)/2,pos)
end
lp = pos
end