So I have 2 loops, I know you can't put a loop inside another because the for loop would not run until my while true loop inside the for loop stops, which is never since it is a while true loop. Here is my code:
script.Parent.MouseClick:Connect(function(player)
for i =1,20 do
local wel = Instance.new("Weld", workspace)
local part = Instance.new("Part", workspace)
prt = Instance.new("Part",workspace)
prt.Material = Enum.Material.Neon
prt.BrickColor = BrickColor.Random()
part.CanCollide = false
part.Transparency = 1
print("worked")
wel.Part0 = part
wel.Part1 = player.Character.LowerTorso
wel.Parent = player.Character.LowerTorso
wel.C0 = CFrame.new(0.67,1,-0.8)
local rocpro = Instance.new("RocketPropulsion",prt)
rocpro.Target = part
rocpro.MaxSpeed = 4000
rocpro.MaxThrust = 2000
prt.CanCollide = false
rocpro:Fire()
wait()
while true do
prt.BrickColor = BrickColor.Random()
wait(0.1)
end
end)
Everything else works of course, but how would I make the while true do loop that changes the brickcolor every 0.1 seconds?

2 comments
You literally just said that you can't embed a while loop in a for loop, so why are you even asking?
youre probably looking for a coroutine or maybe just add the while loop after the for loop since the for loop ends immediately anyway