So i've been ripping my hair out for the past 2 hours, but no matter what I do I just can't seem to fix this roadblocking bug.
function RocketGotoDestination(destination) for i=0, 5, 0.01 do wait(0.01) script.Parent.Rocket:SetPrimaryPartCFrame(script.Parent.Rocket.PrimaryPart.CFrame:Lerp(destination, i/5)) end print("g") end
As you can see, in this code, I have a function which runs a for loop and does a little animation using Lerp. However, in game, whenever the animation is supposed to stop, it does, however no code after it runs. Not even the "print("g")" code I put in for testing.
Any ideas on what could be the issue?
EDIT: so i've managed to fix the issue, which was that I didn't store the CFrame to be lerped into a variable. However, i'm still confused: this is ran in a for loop, not a while loop or whatnot. how come it wouldn't have just stopped then since eventually it would've reached "5" regardless?