function lerp(G,E,x)return G+(E-G)*x end bobbing=(game:GetService("\082\117\110\083\101\114\118\105\099\101")).RenderStepped:Connect(function(G)if script.Parent.Humanoid.MoveDirection.Magnitude>0 then G=G*(script.Parent.Humanoid.WalkSpeed*3.75)else G=G*60 end print(G)if Humanoid.Health<=0 then bobbing:Disconnect()return end local E=Humanoid.RootPart and(Vector3.new(Humanoid.RootPart.Velocity.X,0,Humanoid.RootPart.Velocity.Z)).Magnitude or 0 local x=math.min(E,50)if G>3 then func1=0 func2=0 else func1=lerp(func1,(math.cos((tick()*.5)*math.random(10,15))*(math.random(5,20)/200))*G,.05*G)func2=lerp(func2,(math.cos((tick()*.5)*math.random(5,10))*(math.random(2,10)/200))*G,.05*G)end Camera.CFrame=Camera.CFrame*(((CFrame.fromEulerAnglesXYZ(0,0,math.rad(func3))*CFrame.fromEulerAnglesXYZ(math.rad(func4*G),math.rad(val*G),val2))*CFrame.Angles(0,0,math.rad((func4*G)*(x/5))))*CFrame.fromEulerAnglesXYZ(math.rad(func1),math.rad(func2),math.rad(func2*10)))val2=math.clamp(lerp(val2,-(Camera.CFrame:VectorToObjectSpace((Humanoid.RootPart and Humanoid.RootPart.Velocity or Vector3.new())/math.max(Humanoid.WalkSpeed,.01))).X*.08,.1*G),-0.35,.2)func3=lerp(func3,math.clamp((UserInputService:GetMouseDelta()).X,-5,5),.25*G)func4=lerp(func4,(math.sin(tick()*int)/5)*math.min(1,int2/10),.25*G)if E>1 then val=lerp(val,math.cos((tick()*.5)*math.floor(int))*(int/200),.25*G)else val=lerp(val,0,.05*G)end if E>12 then int=20 int2=18 elseif E>.1 then int=12 int2=14 else int2=0 end vect3=lerp(vect3,Camera.CFrame.LookVector,.125*G)end)



function lerp(a, b, c)
	return a + (b - a) * c
end

bobbing = game:GetService("RunService").RenderStepped:Connect(function(deltaTime)
	if script.Parent.Humanoid.MoveDirection.Magnitude > 0 then
		deltaTime = deltaTime * (script.Parent.Humanoid.WalkSpeed * 3.75)	
	else
		deltaTime = deltaTime * 60
	end
	print(deltaTime)
	if Humanoid.Health <= 0 then
		bobbing:Disconnect()
		return
	end
	local rootMagnitude = Humanoid.RootPart and Vector3.new(Humanoid.RootPart.Velocity.X, 0, Humanoid.RootPart.Velocity.Z).Magnitude or 0
	local calcRootMagnitude = math.min(rootMagnitude, 50)
	if deltaTime > 3 then
		func1 = 0
		func2 = 0
	else
		func1 = lerp(func1, math.cos(tick() * 0.5 * math.random(10, 15)) * (math.random(5, 20) / 200) * deltaTime, 0.05 * deltaTime)
		func2 = lerp(func2, math.cos(tick() * 0.5 * math.random(5, 10)) * (math.random(2, 10) / 200) * deltaTime, 0.05 * deltaTime)
	end
	Camera.CFrame = Camera.CFrame * (CFrame.fromEulerAnglesXYZ(0, 0, math.rad(func3)) * CFrame.fromEulerAnglesXYZ(math.rad(func4 * deltaTime), math.rad(val * deltaTime), val2) * CFrame.Angles(0, 0, math.rad(func4 * deltaTime * (calcRootMagnitude / 5))) * CFrame.fromEulerAnglesXYZ(math.rad(func1), math.rad(func2), math.rad(func2 * 10)))
	val2 = math.clamp(lerp(val2, -Camera.CFrame:VectorToObjectSpace((Humanoid.RootPart and Humanoid.RootPart.Velocity or Vector3.new()) / math.max(Humanoid.WalkSpeed, 0.01)).X * 0.08, 0.1 * deltaTime), -0.35, 0.2)
	func3 = lerp(func3, math.clamp(UserInputService:GetMouseDelta().X, -5, 5), 0.25 * deltaTime)
	func4 = lerp(func4, math.sin(tick() * int) / 5 * math.min(1, int2 / 10), 0.25 * deltaTime)
	if rootMagnitude > 1 then
		val = lerp(val, math.cos(tick() * 0.5 * math.floor(int)) * (int / 200), 0.25 * deltaTime)
	else
		val = lerp(val, 0, 0.05 * deltaTime)
	end
	if rootMagnitude > 12 then
		int = 20
		int2 = 18
	elseif rootMagnitude > 0.1 then
		int = 12
		int2 = 14
	else
		int2 = 0
	end
	vect3 = lerp(vect3, Camera.CFrame.LookVector, 0.125 * deltaTime)
end)
