Ok so I'm making a simple script where on click a part will appear infront of me, move foward, and delete after a distance. (game's like galaga). The issue is I think is it gets caught in the while/do function, disallowing the code to continue.
local cool = 0.75
local function firee()
local bullet = Instance.new("Part")
bullet.Parent = workspace
bullet.Size = Vector3.new(0.75, 0.75, 1.75)
bullet.Position = Vector3.new(root.Position.X, root.Position.Y, root.Position.Z + 4)
bullet.Anchored = true
while bullet do
bullet.Position = bullet.Position + Vector3.new(0, 0, 1)
wait(0.001)
if bullet.Position.Z > 100 then
bullet:Remove()
end
end
end
mouse.Button1Down:Connect(function()
if player.Character then
if debounce then
debounce = false
print("Fire")
firee()
wait(cool)
debounce = true
return
end
end
end)
When I remove firee() from the script the print works fine but when I insert firee it breaks. I also found that if I remove the while/do function and everything inside it it works (but of course doesn't move then). Help?>

2 comments
that variable error from formatting is really giving my mind death and im not sure why
sorry 'bout that, I fixed it.