Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

This camera-shake-on-explosion only works in studio. How would I make it work within a server?

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?

1 answer

silly me, i must've tested it wrong because it works perfectly!

This discussion is preserved as it was. New answers, comments, and votes are closed.