Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How can I make the screen shake less violently?

Asked by 7 years ago

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

Log in to vote
1
Answered by 7 years ago

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! :)

0
Thanks a ton, sorry that I accepted this late. My internet kinda died x.x Kakitoku 32 — 7y
Ad

Answer this question