How to make a basic camera shake using a script?

hello i was wondering how i would make a basic camera shake? Ive got this module and then another script requiring it but it doesnt work, This is by someone else so i have no idea, It says a error attempt to index nil with character

Module script inside StarterPlayerScripts:

--made by kaiyellow2008/YeetComputer

--Put in StarterPlayerScripts

--[[

just put this in starter player scripts as a module script and require it.

to call it you do:

local camerashake = require(game.StarterPlayer.StarterPlayerScripts.CameraShake)

local Xstrength = 30

local Ystrength = 30

local Zstrength = 30

local camerashaketime = 30

camerashake.new(Xstrength,Ystrength,Zstrength,30)

Note: The lower the strength number the the more intense the camera shake will be.

Ex. If you put it to 1 It’ll be very intense and partially glitch your camera for the duration.

]]--

local shake = {}

shake.new = function (y1, x1, z1, time1)

local Players = game:GetService("Players")

local Player = game.Players.LocalPlayer

local Humanoid = Player.Character:WaitForChild("Humanoid")

for i = 1, time1 do

local x = math.random(-100,x1)/x1

local y = math.random(-100,y1)/y1

local z = math.random(-100,z1)/z1

Humanoid.CameraOffset = Vector3.new(x,y,z)

print(i,x,y,z)

game:GetService("RunService").RenderStepped:Wait()

end

Humanoid.CameraOffset = Vector3.new(0,0,0)

end

return shake

Normal script inside a part in workspace:

game.Players.PlayerAdded:Connect(function(Player)
	Player.CharacterAdded:Connect(function(Character)
		local EscapeTrigger = script.Parent.ProximityPrompt
		local camera = game.Workspace.CurrentCamera
		local teleportBackLocation = Vector3.new(448.162, 5.639, -157.451)
		local humanoidRootPart = Character:WaitForChild("HumanoidRootPart")
		local Humanoid = Character:WaitForChild("Humanoid")
		local camerashake = require(game.StarterPlayer.StarterPlayerScripts.CameraShake)
		local Xstrength = 30
		local Ystrength = 30
		local Zstrength = 30
		local camerashaketime = 3

		wait(2)

		EscapeTrigger.Triggered:Connect(function(player)
			humanoidRootPart.Anchored = true
			camerashake.new(Xstrength,Ystrength,Zstrength,30)
			wait(3)
			Player.Character:SetPrimaryPartCFrame(CFrame.new(teleportBackLocation))
			humanoidRootPart.Anchored = false
		end)

	end)
end)