The question might sound confusing at first, but what I'm trying to do is make a script that spawns one part say, 10 studs ahead of the player, then another part that spawns 5 studs ahead of the previous part, and so on and so forth.
I've decided on using for i = 1, 5 do to reduce the amount of code I need to type but one problem; the parts spawn on the same position. This is my current code at the moment:
local anim = Instance.new("Animation")
anim.AnimationId = "rbxassetid://04596442315"
local playanim = c.Humanoid:LoadAnimation(anim)
local BV = Instance.new("BodyVelocity",c.HumanoidRootPart)
BV.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
BV.Velocity = c.HumanoidRootPart.CFrame.lookVector*.01
local oldspeed = c.Humanoid.WalkSpeed
c.Humanoid.WalkSpeed = 0
playanim:Play()
wait(1.75)
playanim:AdjustSpeed(0)
for i = 1, 5 do
local circle = game.Lighting.ASCircle:Clone()
local sound = game.Lighting.ASBlessingSound:Clone()
sound.Parent = circle
sound:Play()
circle.Parent = workspace
circle.CFrame = c.HumanoidRootPart.CFrame*CFrame.new(0,-3,-10)
game.Debris:AddItem(circle, 15)
game.Debris:AddItem(BV, 15)
wait(.15)
end
wait(1.5)
playanim:AdjustSpeed(100)
BV:Destroy()
c.Humanoid.WalkSpeed = oldspeed
end
Any help?
