ScreenShake Module!

Very cool screen shake for your games!

create.roblox.com/store/asset/17397850483

2 Likes

can you post a video or example?

1 Like

This is all of the code:

local Module = {}

function Module.Shake(Character : Model, Duration : number, Strength : number)
	if Character == nil or Duration == nil or Strength == nil then return end
	task.spawn(function()
		local StartTime = os.time()
		repeat
			task.wait()
			local EndTime = os.time()
			local XOffset = math.random(-Strength,Strength) / 800
			local YOffset = math.random(-Strength,Strength) / 800
			local ZOffset = math.random(-Strength,Strength) / 800
			Character:FindFirstChild("Humanoid").CameraOffset = Vector3.new(XOffset,YOffset,ZOffset)
		until EndTime - StartTime >= Duration
		Character:FindFirstChild("Humanoid").CameraOffset = Vector3(0,0,0)
	end)
end

return Module

:sweat_smile:

1 Like

It even adds realistic lag for impact by reindexing the humanoid twice every frame

6 Likes

did you not read what @spookwallyjungle said?

That is atrocious. Kill me now.

3 Likes

Yes, I did. Why?

To me, the worst is that it uses FindFirstChild to get the humanoid, but if it returns nil, it will just error anyway

Also, it only indexes it twice on the last frame