Why wont this camera shake work?

Hey working on a shockwave explosion and my camera shaker for it isnt working here is the code

 camera.CFrame = camera.CFrame *  CFrame.new(math.random(-1,1),math.random(-1,1),math.random(-1,1))
wait(4)
camera.CFrame = camera.CFrame * CFrame.new(0,0,0)

This part of the script is in a proximity promt trigger function.

the camera varible is workspace.CurrentCamera

You can try putting it in a while loop like this:

while wait() do
     camera.CFrame = camera.CFrame *  
     CFrame.new(math.random(-1,1),math.random(-1,1),math.random(-1,1))
end
1 Like

Didnt work plus it didnt run the code under it.

Yeah it didn’t run the code under it, its looping forever. If its not in the loop it won’t run unless you break the loop.

Plus

this won’t tween to make a shaking effect.

1 Like

How would i make a shaking effect then?

You could create a new tween and switch between the two to make a shaking effect.

1 Like

You can also create a cam shake effect using a module:

1 Like

I was just finishing up using that! Thanks for recommending anyways though!

1 Like