Hey!
I was making animations with sin and cos for display arms and I came through something. So, I wanted the display arms to tween back to the middle of the screen when you aren’t moving or you stopped moving. So, if I tweened or lerped it to the middle of the screen, the display arms would clip to the middle of the screen and not be smooth. Then, if I added a wait for tweening, the display arms would start blinking? Then, if I added a wait for lerping, the display arms would not be smooth and would not keep up with the camera.
Here is my code (Tweening):
ViewModel.HumanoidRootPart.Anchored = true
local t = game:GetService("TweenService"):Create(ViewModel.HumanoidRootPart, TweenInfo.new(0.01), {CFrame = workspace.Camera.CFrame})
t:Play()
t.Completed:Wait()
ViewModel.HumanoidRootPart.Anchored = false
That would start blinking?
Here is my code (Lerping):
for i = 0, 1, .01 do
ViewModel.HumanoidRootPart.Anchored = false
ViewModel.HumanoidRootPart.CFrame = ViewModel.HumanoidRootPart.CFrame:Lerp(workspace.Camera.CFrame, i)
ViewModel.HumanoidRootPart.Anchored = true
wait(.0000001)
end
I really don’t understand why this is happening. Can somebody tell me in depth on how to fix this and what is the most recommended choice to use.
Dragon