Shake.Create=function(A,O,s,W)if(_L.Player.Get("\067\097\109\101\114\097")).CameraType==Enum.CameraType.Scriptable then return end shakeId=shakeId+1 A=A or 1 O=O or 1 s=s or 0 W=W~=nil and W or false;(coroutine.wrap(function()local q=shakeId local U=tick()local P local Y=tick()while shakeId==q and tick()-U<=A do local q=(tick()-U)/A if not P or tick()-Y>=s/10 then Y=tick()local A=W and math.sin(q*math.pi)or math.sin((.5+q/2)*math.pi)local s=(rng:NextNumber(-A,A)*A)*O local U=(rng:NextNumber(-A,A)*A)*O local R=(rng:NextNumber(-A,A)*A)*O P=Vector3.new(s,U,R)if _L.Variables.Console and _L.Services.HapticService:IsVibrationSupported(Enum.UserInputType.Gamepad1)then local s=math.min(O,1)*A _L.Services.HapticService:SetMotor(Enum.UserInputType.Gamepad1,Enum.VibrationMotor.Large,s)end end;(_L.Player.Get("\072\117\109\097\110\111\105\100")).CameraOffset=(_L.Player.Get("\072\117\109\097\110\111\105\100")).CameraOffset:Lerp(P,1-s)_L.Services.RunService.RenderStepped:Wait()end;(_L.Player.Get("\072\117\109\097\110\111\105\100")).CameraOffset=Vector3.new(0,0,0)if _L.Variables.Console and _L.Services.HapticService:IsVibrationSupported(Enum.UserInputType.Gamepad1)then _L.Services.HapticService:SetMotor(Enum.UserInputType.Gamepad1,Enum.VibrationMotor.Large,0)end end))()end



Shake.Create = function(length, strength, smoothness, fadeIn)
	--- Only works with character-bound cameras
	if _L.Player.Get("Camera").CameraType == Enum.CameraType.Scriptable then
		return
	end
	--
	shakeId = shakeId + 1
	length = length or 1
	strength = strength or 1
	smoothness = smoothness or 0
	fadeIn = fadeIn ~= nil and fadeIn or false
	--
	coroutine.wrap(function()
		local localShakeId = shakeId
		local startTick = tick()
		local cameraOffset
		local lastTickIncrement = tick()
		--
		while (shakeId == localShakeId and (tick() - startTick) <= length) do
			local timeFloat = (tick() - startTick) / length
			--
			if not cameraOffset or tick() - lastTickIncrement >= (smoothness / 10) then
				lastTickIncrement = tick()
				local timeSine = (fadeIn and math.sin(timeFloat * math.pi) or math.sin((0.5 + (timeFloat / 2)) * math.pi))
				--
				local x = rng:NextNumber(-timeSine, timeSine) * timeSine * strength
				local y = rng:NextNumber(-timeSine, timeSine) * timeSine * strength
				local z = rng:NextNumber(-timeSine, timeSine) * timeSine * strength
				--
				cameraOffset = Vector3.new(x, y, z)		
				
				--- Haptic feedback (controller shaking)
				if _L.Variables.Console and _L.Services.HapticService:IsVibrationSupported(Enum.UserInputType.Gamepad1) then
					local shakingAlpha = math.min(strength, 1) * timeSine
					_L.Services.HapticService:SetMotor(Enum.UserInputType.Gamepad1, Enum.VibrationMotor.Large, shakingAlpha)
				end
			end
			--
			_L.Player.Get("Humanoid").CameraOffset = _L.Player.Get("Humanoid").CameraOffset:Lerp(cameraOffset, (1 - smoothness))
			_L.Services.RunService.RenderStepped:Wait()
		end
		--
		_L.Player.Get("Humanoid").CameraOffset = Vector3.new(0, 0, 0)
		--
		if _L.Variables.Console and _L.Services.HapticService:IsVibrationSupported(Enum.UserInputType.Gamepad1) then
			_L.Services.HapticService:SetMotor(Enum.UserInputType.Gamepad1, Enum.VibrationMotor.Large, 0)
		end
	end)()
end

