idleAnimationTrack:Play(0,1,1)local e=game:GetService("\085\115\101\114\073\110\112\117\116\083\101\114\118\105\099\101")local X=game:GetService("\082\117\110\083\101\114\118\105\099\101")local y=workspace.CurrentCamera local j=CFrame.new()local Z=CFrame.new()local B=0 X.RenderStepped:Connect(function()local X=e:GetMouseDelta()/50 if hum.MoveDirection.Magnitude>0 then B=1 else B=0 end local P=math.clamp(X.X,-0.2,.2)local S=math.clamp(X.Y,-0.2,.2)local U=math.cos(((tick()*5)*hum.WalkSpeed)/16)*.2 local g=math.abs(math.sin(((tick()*6)*hum.WalkSpeed)/16)*.3)j=j:Lerp(CFrame.new(U*B,g*B,0),.4)Z=Z:Lerp(CFrame.new(P,S,0),.3)viewmodel.Camera.CFrame=(y.CFrame*j)*Z end)

idleAnimationTrack:Play(0, 1, 1)

local uis = game:GetService("UserInputService")
local runservice = game:GetService("RunService")

local camera = workspace.CurrentCamera

local bobCF = CFrame.new()
local swayCF = CFrame.new()

local running = 0

runservice.RenderStepped:Connect(function()
	local mouseDelta = uis:GetMouseDelta()/50 -- divida pelo valor que desejar

	if hum.MoveDirection.Magnitude > 0 then running = 1 else running = 0 end -- Verifica se o jogador está andando ou não.

	local swayX =  math.clamp(mouseDelta.X, -0.2,0.2) -- Nós limitamos para que não tenhamos resultados estranhos
	local swayY = math.clamp(mouseDelta.Y, -0.2,0.2)

	local bobX = math.cos(tick() * 5 * hum.WalkSpeed/16) * .2 -- Os números dentro dos () fazem a velocidade, e o .2 é a intensidade, tanto para o Y quanto para o X
	local bobY = math.abs(math.sin(tick() * 6 * hum.WalkSpeed/16) * .3)

	bobCF = bobCF:Lerp(CFrame.new(bobX * running,bobY * running,0) , .4) -- Torna suave
	swayCF = swayCF:Lerp(CFrame.new(swayX, swayY, 0), .3)

	viewmodel.Camera.CFrame = camera.CFrame * bobCF * swayCF -- Pronto

end)
