How to Tween the camera rotation left or right?

Hey! so I’m working on a gun system and to make the movement feel smooth. I’m trying to make the camera slightly rotate left or right dependent on which way the player is walking.

I found some code on a different post which worked but it wasn’t tweened or tweenable the way it was set up. I tried to make it to where it would work but nothing happens when I move.
anyone know a solution?

I’m not getting any errors in the output either at least when I looked a few times

all other things involving the camera are working fine in the local script

UserInputServ.InputBegan:Connect(function(input, gameProcessed)
	
	if input.KeyCode == Enum.KeyCode.A then
	
		local x,y,z = camera.CFrame:ToEulerAnglesXYZ()

	TS:Create(camera, TweenInfo.new(.75), {CFrame = CFrame.new(camera.CFrame.Position) * CFrame.Angles(x,y,z) * CFrame.Angles(0,0,math.rad(1.5))}):Play()
		
	end


I tried reconstructing your code to show the different processes that are happening in this tween. I have this in a LocalScript and it seems to be running, although it does make the camera stationary while tweening:

UserInputServ = game:GetService(“UserInputService”)
camera = workspace.CurrentCamera

UserInputServ.InputBegan:Connect(function(input, gameProcessed)

if input.KeyCode == Enum.KeyCode.A then

  local x,y,z = camera.CFrame:ToEulerAnglesXYZ()

  local goal = {}
  goal.CFrame = CFrame.new(camera.CFrame.Position) * CFrame.Angles(x,y,z) * CFrame.Angles(0,0,math.rad(1.5))
  local tweenInfo = TweenInfo.new(.75)
  local tween = game:GetService("TweenService"):Create(camera, tweenInfo, goal)
  tween:Play()

Ah I totally forgot that it makes the camera stationary when tweening

Ill have to do some gheto for i loop to make it look like an actual smooth camera movement

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.