Lerping the PrimaryPart of a Model not working?

Hi,

This is probably a Very Simple thing to fix.
I am trying to Lerp a Model to the Camera, but its not Positioning where I want it to, I tried other methods but it doesn’t seem to work, which is odd because I had it working before.

Note that I do not want TweenService, I prefer a Linear Approach which is CFrame:Lerp()
Both don’t work for some reason.

Any Idea’s?


config is a ModuleScript
config.Camera is workspace.CurrentCamera
config.OffCF (meaning OffsetCFrame) is the Offset from the Camera (or Current CFrame)


config.RunService.PreRender:Connect(function(dt)
	Arms.PrimaryPart.CFrame:Lerp(config.Camera.CFrame * config.OffCF, .1)
end)

The Lerp function returns a value, it doesn’t set it. Try this:

config.RunService.PreRender:Connect(function(dt)
	Arms.PrimaryPart.CFrame = Arms.PrimaryPart.CFrame:Lerp(config.Camera.CFrame * config.OffCF, .1)
end)

Doesnt work, I have already tried it

Another thing about the primary part, are all the other parts in the model welded, and unanchored to it? the primary part should be anchored, too.

No, Anchoring the Primary Part doesn’t work

Plus, I plan to add Animations.

What do you mean anchoring the primary part doesn’t work? If you don’t anchor it, you can’t use that method. You should make a new invisible part that is the base of the model. Just like HumanoidRootPart. Then set the primary part of the model to that part and tween IT.

What are you talking about?

It still works, But for some reason, its being Positioned in the void

You should consider adding a wait or use a loop instead of prerender. It fires extremely frequently, and that may be why. I seriously recommend just using TweenService.

Doesnt work either, And I already said why I dont want to use it:

Do you understand what RunService.RenderStepped does?

I don’t understand what’s wrong with TweenService. I don’t understand a “linear approach” is.

Of course I understand what RunService.RenderStepped does. But I also understand how fast it goes. You’re executing that line of code every render step, your model will move extremely fast, and you probably won’t achieve the effect you want.

This worked before, and I dont understand why it isnt working now.

Can you give some more context on what you want to do?

The code you provided in the first post WILL NOT WORK. It’s not doing anything. It’s no different from saying

string.find(str, "hi")

It literally doesn’t do anything. It just finds something in a string, and returns it nowhere.

What does this have to do with the Topic?

Basically, I’m trying to Lerp a Viewmodel, It worked before but for some reason, its not Positioning Correctly

You need to assign the value. That’s why nothing is happening.

Why do you think I keep saying its not working?

Its working, but its not positioning correctly

Because this code WOULDN’T work. Also

Are you accessing the current camera from the server?

RenderStepped and CurrentCamera can only be accessed on the Client.

Try printing some values, and see what goes. Make sure none of them are weird, 0, huge or nil.