Tweening the camera

Hello! I am COWTACO, a fellow scripter of the roblox community and I’ve encountered an issue that I can’t really seem to solve. I’ve searched for countless other topics, but no clear solution to this was found. If you helped me, it would mean the world to me.

To start off, I wish to tween the camera in a circular motion (180 degrees) while facing my character at all times. However I have no clear idea of what I can do to accomplish that.

The closest I’ve gotten is tween the camera 90 degrees to the left, but no further than that. I’ve also tried to tween the camera to a specific block, but it doesn’t perform a circular motion, but it just rather moves the camera to it as expected. I’ve tried to use another tween using kind of the same code as well, but nothing happened.

How would I go about doing that?
I’ll be sure to leave the script I am currently using and a video for reference.

local function Rotating()
	if Player.Character and Player.Character:FindFirstChild("HumanoidRootPart") then
		local TweenService = game:GetService("TweenService")
		local tweenInfo = TweenInfo.new(1, Enum.EasingStyle.Bounce, Enum.EasingDirection.Out)
	camera.CameraType = Enum.CameraType.Scriptable
	local tween = TweenService:Create(camera, tweenInfo, {CFrame = (Player.Character.HumanoidRootPart.CFrame) * CFrame.Angles(math.rad(180),math.rad(180),math.rad(180))})
	tween:Play()	
  end
end

CameraRotator.Touched:Connect(function()
	Rotating()
end)

The current script above while it does turn the camera, it doesn’t it turn it further, which is what I wish to do. My goal is to turn once more at about 90 degrees to face the humanoid the other way.
Video:
https://gyazo.com/2e28b1b4f5d5b0d29f7f6068b497a1e9

I am not really certain how I would go about doing that and I could really use some help. Thank you in advance.

1 Like

There are several ways you could do this but for you, I would suggest doing something along the lines of

CFrame = CFrame.new(block.position, rootpart.position)

Which basically places the camera at the position of the block while looking at your root part

3 Likes

I’ll try it out in a bit as I am unable right now. Thank you for replying

2 Likes

Alright, so I found my way of doing it and yes you were right. I used the line of code you gave me above and changed it so I got the desired result. Though it did take me a while, I think I managed what I wanted to do. Thank you for your help!

2 Likes