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

How can I make the screen shake less violently?

Hi, I have created a script and it works fine however when the screen shakes, it shakes too violently and too much. I only want it to shake a little bit, more like a wobble. Here is my code:

local player = game.Players.LocalPlayer
local Character = player.Character
local mouse = player:GetMouse()

mouse.Button1Down:connect(function()
	for i = 1,22 do
Character.Humanoid.CameraOffset = Vector3.new(math.random(-.61,.61),math.random(-.61,.61),math.random(-.61,.61)) -- This is one line
		wait()
	end
		Character.Humanoid.CameraOffset = Vector3.new(0,0,0)
end)


I tried changing the values of .61 lower and higher, but it still just looks the same. Anything lower than .61 and it will not work. If there is a more efficient way of making the screen shake I would really like to hear it ^^ Thanks

1 answer

✓ Accepted answer

I played around with CameraOffset a little bit and found a solution. After setting the CameraOffset, you can divide said offset by however much you want (I did 5) to make it less shakier. Here's what I did, addition on line 8.

local player = game.Players.LocalPlayer
local Character = player.Character
local mouse = player:GetMouse()

mouse.Button1Down:connect(function()
	for i = 1,22 do
		Character.Humanoid.CameraOffset = Vector3.new(math.random(-.61,.61),math.random(-.61,.61),math.random(-.61,.61))
		Character.Humanoid.CameraOffset = Character.Humanoid.CameraOffset/5
		wait()
	end
	Character.Humanoid.CameraOffset = Vector3.new(0,0,0)
end)

If I helped, leave an upvote and accept the answer! Thanks a lot! :)

1 comment

0

Thanks a ton, sorry that I accepted this late. My internet kinda died x.x

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