Hi, I have a script that makes the camera shake every time an explosion happens close to the player.
ShakeDist = 50 workspace.ChildAdded:connect(function(nchild) if nchild:IsA("Explosion") then local ExDist = (game.Players.LocalPlayer.Character.Torso.Position - nchild.Position).magnitude local ShakeMagnitude = ShakeDist/(ExDist/(nchild.BlastRadius/20)) for z = 1, 10 do game.Players.LocalPlayer.Character.Humanoid.CameraOffset = Vector3.new(math.random(-ShakeMagnitude,ShakeMagnitude),math.random(-ShakeMagnitude,ShakeMagnitude),math.random(-ShakeMagnitude,ShakeMagnitude)) wait() end game.Players.LocalPlayer.Character.Humanoid.CameraOffset = Vector3.new(0,0,0) end end)
it's located in a local script inside starterpack, on a FE game. it works perfectly in studio, but doesn't work otherwise. i cant seem to put my finger on whats wrong. any ideas?
silly me, i must've tested it wrong because it works perfectly!