Guys, how to make viewmodel bobbing like this (desc.)

Example:

I have everything done but idk how to make bobbing like this correctly. currentGun = viewmodel

2 Likes

I think they manually inserted animations and checked when the player was moving. It looks like they make it fade in, too.

animation:Play(0.5)
1 Like

:skull: nah, this is not an animation. This is a script

1 Like

Are you certain? To me it looks like an animation. It doesn’t look like something made in Roblox though, maybe Blender.

1 Like

On closer inspection, it looks like it is using a looping sinewave to create a bobbing effect. Something like this:
Sinewave
Here is some example code to get you on the right track:

local Number = 0
while true do
	Number += 5
	local Number2 = math.rad(Number)
	local Number3 = math.cos(Number2/4) * 4
	local Number4 = math.sin(Number2/2) * 2
	script.Parent.Position = Vector3.new(Number3,25 + Number4,0)/10
	task.wait()
end

(I’m going to be honest with you, I have no idea what this code does. I wrote it well over three years ago, and I was always terrible with maths. Hopefully this page should help!

2 Likes