I'm using the CFrame:lerp() function to move/Tween a model from one place to another in a for i,v loop. Here's the code I wrote for that:
local model = script.Parent.Parent
local dest = CFrame.new(72.69, 2, -27.46)
for i = 0,1,.00001 do
wait(0.01)
model:SetPrimaryPartCFrame(model.PrimaryPart.CFrame:lerp(dest, i))
end
Notice: The model variable is a model (no duh) and it is also anchored.
What this script does is it Tweens the model, without tweening it because you can't tween models. All I want to know is how can I keep the model's Orientation to keep pointing at the destination? I attempted CFrame.lookVector And here's how I took a shot at it:
local model = script.Parent.Parent
local dest = CFrame.new(69.69, 2, -27.46)
for i= 0,1,.00001 do --.00001
wait(0.01)
model:SetPrimaryPartCFrame(model.PrimaryPart.CFrame:lerp(dest, i))
model.PrimaryPart.Orientation = CFrame.lookVector(72.69, 2, -27.46)
end
Line 7 was where I put the thing I want it to do. But when I ran it, it stopped the level preview and highlighted the line in red. Welp, can someone tell me what I can do? Thank u!!!
