How can I make my screen shake?

I honestly think it would be a bit choppy if you just run this. I would consider something that would work smoother.

I can’t think of any alternatives at the moment, but when I do, I’ll be sure to reply.

1 Like

Check out @Crazyman32’s EZ Camera Shake module. It is very easy to use and performs great looking and efficient shakes.

10 Likes

https://wiki.roblox.com/index.php?title=Random#Random.new Use random.new() instead of math.random, which requires a seed to be inputted instead of random.new(), where if no parameters are given, will automatically put in a new randomized seed.

I’m pretty sure math.random() was updated to use the same algorithm as Random.new(). The difference is that Random sports slightly more capabilities while math.random() is anchored to either a 0-1 value or a minimum and maximum. math.randomseed() is no longer a requirement.

This is correct I think; I’ve been told math.random uses the Random class under the hood. Either way bringing up math.random versus Random.new() seems like a non-point in the scheme of this thread.

2 Likes

You can consider this randomizing method if you want to achieve what you want. This is specifically indicated for table values, but it can be used regardless.

Ah, my mistake. I’ll just go ahead and delete my useless post now…

1 Like

It’s not that you have to delete your post if you’re wrong - the DevForum is a learning resource and a discussion platform. There are things you and I both don’t know. You didn’t know before, you know now. The point was relatively relevant in terms of what can be used to achieve a random effect (which is part of what OP requires, a way to fetch random numbers, so that it can be applied to a loop of some sort to make their screen shake). Just remember to stay on-topic and work towards helping OP find a solution.

5 Likes

As a general note, you probably should’nt delete your posts that were involved in a conversation since they add to the conversation of the post.

1 Like

Oh okay sorry I’m really new to this. How would I go about undeleting a post? Edit : Found the button

Thanks! That worked.

I will definitely try that out and see what happens.

It looks really great but how do you go about using it? I’m still pretty new to all this stuff so I wouldn’t know where to put all the scripts just yet. :sweat_smile:

Examples are given in the post, as well as in the comments.

If you are talking about where the ModuleScript is supposed to be, you just need to put it where a localscript can require it. For instance, ReplicatedStorage would be a suitable place.

Make sure to put @ExtremeBuilder15 's answer as the solution if it worked!

1 Like

Oh thank you ill try out that soon. Thanks for yhe heads up. :slight_smile:

No problem. Whenever you need help, just ask! :smile:

I like this one:

local function Shake_Cam_Event_sub()
	local x = math.random(-100,100)/100
   	local y = math.random(-100,100)/100
   	local z = math.random(-100,100)/100
	local step_int = 1
	for counter_a = 10, 0, -1 do
		step_int = step_int * -1
		local shift_int = counter_a/10 * step_int
		local xx = x*shift_int
		local yy = y*shift_int
		local zz = z*shift_int
		Humanoid.CameraOffset = Vector3.new(xx,yy,zz)
		wait(0.01)
	end
end
15 Likes

May i know why we need math.random(-100,100)/100