Low-Intensity Camera Shake Module thumbnail
0 views0 copies0 likes

Low-Intensity Camera Shake Module

Universal script

Copy it, then test it in your own Studio place.

UI systems Verified

Script code

29 lines · 0.9 KB
Download
local RunService = game:GetService("RunService")local CameraShake = {}local key = "SoftCameraShake"local camera, lastfunction CameraShake.Stop()	RunService:UnbindFromRenderStep(key)	if camera and last then camera.CFrame -= last end	camera, last = nil, nilendfunction CameraShake.Start(strength, duration)	CameraShake.Stop()	strength = math.clamp(strength, 0, 0.8)	duration = math.clamp(duration, 0.05, 2)	local began = os.clock()-- …open Get script for the full source

About this script

Use this ModuleScript from a LocalScript for a brief landing or puzzle-completion camera cue. Call Start with a strength and duration to apply small, decaying positional offsets after the default camera update. Stop releases the render update immediately and clears its last offset. Begin with a strength near 0.25 and pair it with a reduced-motion option in your game.

Comments

Share what works, ask questions, or report an issue.

0

Log in to leave a comment.

No comments yet

Be the first to share your thoughts!

Raw Luau source

local RunService = game:GetService("RunService")
local CameraShake = {}
local key = "SoftCameraShake"
local camera, last
function CameraShake.Stop()
	RunService:UnbindFromRenderStep(key)
	if camera and last then camera.CFrame -= last end
	camera, last = nil, nil
end
function CameraShake.Start(strength, duration)
	CameraShake.Stop()
	strength = math.clamp(strength, 0, 0.8)
	duration = math.clamp(duration, 0.05, 2)
	local began = os.clock()
	RunService:BindToRenderStep(key, Enum.RenderPriority.Camera.Value + 1, function()
		local fraction = (os.clock() - began) / duration
		if fraction >= 1 then
			camera, last = nil, nil
			RunService:UnbindFromRenderStep(key)
			return
		end
		camera = workspace.CurrentCamera
		if not camera then return end
		last = Vector3.new(math.noise(fraction * 17, 0, 0), math.noise(0, fraction * 19, 0), 0)
			* strength * (1 - fraction)
		camera.CFrame += last
	end)
end
return CameraShake