I wanna tween a offset value that is a CFrame, but whenever i throw
for i = 0, 1, 0.01 do
offset:Lerp(CFrame.new(-1.5, -4.6, 2), i)
task.wait()
end
It doesnt do anything. Any help is appreciatted. To clarify what im trying to achieve:
I wana smooth that out, so i wanna set the offset to CFrame.new(-1.5, -4.6, 2) but smoothly
You need to assign the lerped CFrame to the CFrame of an object for it to update.
Set offset:Lerp(CFrame.new(-1.5, -4.6, 2), i) to the CFrame of the object you want to set.
for i = 0, 1, 0.01 do
object.CFrame = object.CFrame:Lerp(CFrame.new(-1.5, -4.6, 2), i)
task.wait()
end
As @GIassWindows said, TweenService would be better to use.
This is going off where it is now then tweening to the offsets. Speed here is set to 2. Try whatever works best for you.
local TweenService = game:GetService("TweenService")
local part = workspace.Part -- your part
local initialCFrame = part.CFrame
local targetCFrame = CFrame.new(-1.5, -4.6, 2)
local goal = {CFrame = targetCFrame}
local tweenInfo = TweenInfo.new(2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out)
local tween = TweenService:Create(part, tweenInfo, goal)
tween:Play()
Can mess around with these also: Enum.EasingStyle.Quad, Enum.EasingDirection.Out
maybe … Enum.EasingStyle.Linear, Enum.EasingDirection.InOut or just Enum.EasingStyle.Linear