How to make the camera sway like this?

hey all, im trying to recreate the camera sway that is found in a car racing game, which looks like this.

what methods could I use to recreate it? im still trying to learn camera math and such and cant figure this out. I also wonder how to use the right stick on the gamepad to pan the camera around like this

any help would be very much appreciated!


I’m with you, trying to learn camera manipulation. My best guess is a tween to the cars LookVector?

I might be wrong here, but to me this looks like the default camera behavior for the Follow CameraType mode.

You can use renderstepped and springs to kind of make the camera sway around.

Spring module:

and then once you have the springs

-- local script obviously
local springs = require(
local sway = springs:create()

local function getSway(addition,speed,modifier)
    return math.sin(tick()*addition*speed)*modifier -- lol i got this from BlackShibe's fps tutorial

    local swaySpeed,swayAmount = 0.5,0.1 -- the variables are what the names are

    local movementSway =,speed,modifier),getBobbing(5,speed,modifier),getBobbing(5,speed,modifier))

    sway:shove((movementSway / 50) * deltaTime * 10* velocity.Magnitude)

    local update = sway:update(dt)

    workspace.CurrentCamera.CFrame = workspace.CurrentCamera.CFrame * CFrame:Angles(0,update.Y,update.X)

lots of this code(actually most of it) is from this tutorial:

and idk if it will work for your car but you can try

edit: like what @Rocky28447 said im pretty sure thats the follow cameratype mode


so things like “getBobbing” is a function inside the module? testing this out right now and integrating it with my car so i need to make sure this is correct

edit 1: also what does walkcycle mean in this context? my car doesnt use a walk cycle so i dont know what you mean by that. i also am confused with the getBobbing, do i have to make a funciton out of it? and the speed and mod, do i insert those values myself?

1 Like

whoops not walkcycle i forgot somethin

1 Like

ok so i tried your updated script and when sway.update() is called it errors at line 38 in the module because there is no number provided

whhhooooopppsssss put the dt into the update

god my brain needs halp

1 Like

it still is erroring.


also do i need to change the camera’s type to scriptable?

im not sure

you can try

can you paste ur code, all the stuff in the renderstep stuff

	local velocity = car.DriveSeat.Velocity
	local swaySpeed, swayAmount = 0.5, 0.1 

    local movementSway =, 2, 1.5), getSway(5, 1, 1.1), getSway(5, 1, 1.1))

	sway:shove((movementSway / 50) * deltaTime * 10* velocity.Magnitude)
	local update = sway.update(deltaTime)

    workspace.CurrentCamera.CFrame = workspace.CurrentCamera.CFrame * CFrame.Angles(0, update.Y, update.Y)

it only errors when sway.update() is called

aaaa use

i had the same issue with fastcast once
replacing the . with a : should work

1 Like

change all the numbers in the code to suit ur needs

it works now, but it sways way too much, i want it only to sway when im turning the car with a or d, or using the left stick

is there a way i can use a camera part to integrate into a script?

ohhhh thats what you wanted ok

    local velocity = car.DriveSeat.RotVelocity.Y -- something so the script knows how much the car is turning
    local swayAmount = 0.1

    local movementSway = swayAmount * (velocity / 100) -- multipliying the amount to the velocity so more turn = more sway

    local update = sway.update(deltaTime)

        workspace.CurrentCamera.CFrame = workspace.CurrentCamera.CFrame * CFrame.Angles(0, update.Y, update.Y)


something like that

dinner xd


this is working the way i am integrating it into my car, thank you so much man, big help