EZ Camera Shake ported to Roblox

This module is great, thank you!

2 Likes

This module is amazing… thanks!

1 Like

Wow. This was super flexible and easy to add with my fighting attacks. I like the explosion preset the most as it’s most compatible with attacks that I make.

2 Likes

How do you make the camera shake when close to a part? The shake is more intense the closer you are to it.

2 Likes

The module seems to not work? I honestly dont know what im doing wrong

local EM = game.ReplicatedStorage.EssentialModules

local CameraShake = require(EM:FindFirstChild("CameraShaker"))


script.Parent.MouseButton1Click:Connect(function()
	CameraShake:Shake(CameraShake.Presets.Vibration)
end)

1 Like

Check out the example code inside the original post, which shows you how to do a shake.

You need to create a new CameraShaker object, and providing the function with a render priority and a function where you use the CFrame provided by the module.

2 Likes

Does this work in a server script im using the same script ur using but its not working

1 Like

It’s the server, not local.
Keyword “local” there. :neutral_face:

1 Like

well It works in local scripts for me but not in server scripts

1 Like

Basically it only works in local scripts, since the effect is purely local. You have to shake the screen for the client and that’s a local effect. Basically what you can do is hook a server script to a remote event which then tells a local script to shake the client’s screen.

2 Likes

Hey, I’ve used this camera shaker before and know the basics of creating the effect, but would I be able to make a shake(Like earthquake / sustain shake) increase in magnitude if it gets closer to a part?

2 Likes

I’m not allowed to give free scripts or I’ll get a strike, but here is an example:

while wait() do
    local shake  = cameraShaker:Shake(cameraShaker.Presets.Explosion)
    local part = workspace.Part
    local distance = (game.Players.LocalPlayer.Head.Position - part.Position)
    shake:SetScaleMagnitude(distance/16)
end```
2 Likes

Has anyone else run into a problem where you can’t shake the camera if you are already setting the camera’s CFrame elsewhere in the script? In my instance I have a lock on camera that uses the Humanoid Root Part’s CFrame along with an offset.

When I set the camera.CFrame = insertCFrameHere, the camera shake no longer applies, and I’m not sure what to do

3 Likes

I discovered that Shaker:Shake(Presets.Bump) can range from light shaking, to rocking the whole screen for no reason, is there a way for me to fix this?

2 Likes

For some reason, the preset vibrate isnt sustaining for me, it goes away pretty fast
Edit: apparently you have to use module:ShakeSustain or something (Noted in the github)

2 Likes

yes im struggling with this too. Any solutions?

I solved it! I put the shakeCf into a CFrame Value:

local camShake = CamShaker.new(Enum.RenderPriority.Camera.Value - 1, function(shakeCf)
	--	Camera.CFrame = Camera.CFrame * shakeCf
		Data.shakeCf.Value = shakeCf
	end)

and then i multiplied it by the Camera CFrame

		* CFrame.Angles(0,math.rad(AngleY),0) 
		* CFrame.Angles(math.rad(AngleX),0,0)
		* HeadOffset -- offset
		* (character.Data.shakeCf.Value)
	

good luck bro!

4 Likes

Where is Data defined and what does it do?

Edit: Nevermind that question, Got it now, thanks :slight_smile:

Edit2: lol scratch that, actually what is the “AngleY” and “AngleX”?

1 Like

AngleY and AngleX are the position of the mouse. Its part of the Camera script. Data is where i store data for the character. Just a folder to put my values in.

2 Likes

Question: Can this work for a tornado or volcano erruption as well?

I wonder if you have a preset for a basic hit attack, but overall very useful module