Screenshake script isnt working

  1. What do you want to achieve? Im trying to make it so when the player’s character is the near the part. it shakes the screen, i am using EZ camera shaker

  2. What is the issue? It doesnt work. ive tried using some stuff from the module instructions but no luck.

  3. What solutions have you tried so far? Ive looked everywhere on the devfourms. cant seem to find a solution.

local CameraShaker = require(game:GetService('ReplicatedStorage'):WaitForChild("CameraShaker"));
local camera = workspace.CurrentCamera
local camShake = CameraShaker.new(Enum.RenderPriority.Camera.Value, function(shakeCf)
	camera.CFrame = camera.CFrame * shakeCf
end)
game.Players.PlayerAdded:Connect(function(player)
	local character = player.Character or player.CharacterAdded:Wait()

	while wait() do
		camShake:Start()
		local shake  = camShake:Shake(CameraShaker.Presets.Explosion)
		local part = workspace.Part
		local distance = (character.Head.Position - part.Position)
		shake:SetScaleMagnitude(distance/10)
	end
end)

(Sorry if the code is messy)

1 Like

Let’s start off with basic troubleshooting.

Are you sure that CameraShaker is in ReplicatedStorage and not anywhere else and is it the right and most up to date version of EZ Camera Shake?

Shouldn’t you use anything but a while wait() do? What about another way to loop it?

Is :Shake() and .new a valid method and constructor for CameraShaker?

Have you used breakpoints to see if distance is set to the correct value? Does the data type need to be an CFrame or a number?