Lerp is instant instead of smooth

This is a support category for asking questions about how to get something done on the Roblox websites or how to do something on Roblox applications such as Roblox Studio.

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? I want my gun to aim smoothly and not instantly

  2. What is the issue? problem instead
    of lerping smoothly it lerps instantly as shown in the gif. (sorry it looks bad lol)

  3. What solutions have you tried so far? I searched devforum but I couldn’t find any posts that could help my situation.

  4. heres the part where i lerp the aim cframe:

m.Button2Down:Connect(function()
	if state ~= 0 then
		aimming = true
		aimoffset = aimoffset:Lerp(CFrame.new(-6.7,3.5,0) * CFrame.Angles(0,math.rad(-3),0), 0.1)  
	end
end)
  1. The part where I update the gun’s aim cframe (its inside a function that’s called in a renderstepped loop):
	viewmodel.HumanoidRootPart.CFrame = camera.CFrame * offset * aimoffset

(sorry for putting low effort into the post, i’ll include any info you ask for)

lerping isnt supposed to be smooth, the way it works is the alpha number is the percentage of the way of the cframe (that was very not well explained)

you’d have to use for loops for example

for i = 1, 100 do
	aimoffset = aimoffset:Lerp(CFrame.new(-6.7,3.5,0) * CFrame.Angles(0,math.rad(-3),0), i / 100) 
end

btw wrong category it should be #help-and-feedback:scripting-support

1 Like

thanks for the help! I had to tweak it abit but it looks decent now

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.