I wanna try to make a camera that spins like a panorama. I’m not sure how to do this, I know how to tween the camera to make it go up, but I have not the slightest idea how to make the camera spin like a panorama. A perferct example of this is Brookhaven, when you first join, the camera circles around you and then stops when you hit the button.
This is quite simple, all you have to do is get the current camera’s cframe, add on some angles and repeat that until the player clicks the button
example would be like
local clickedButton = false
game:GetService("RunService").RenderStepped:Connect(function()
if clickedButton == false then
camera.CFrame = camera.CFrame * CFrame.Angles(math.rad(1),0,0)
end
end)
How can I modify it to circle around the avatar?
I have a script that rotates around a certain part well, but how do I make it set back?
Code, everything works except the MouseButton1Click.
local TweenService = game:GetService("TweenService")
local RunService = game:GetService("RunService")
local target = workspace:FindFirstChild("Part") -- The object to rotate around
local camera = workspace.CurrentCamera
camera.CameraType = Enum.CameraType.Scriptable
local rotationAngle = Instance.new("NumberValue")
local tweenComplete = false
local cameraOffset = Vector3.new(0, 10, 12)
local rotationTime = 15 -- Time in seconds
local rotationDegrees = 360
local rotationRepeatCount = -1 -- Use -1 for infinite repeats
local lookAtTarget = true -- Whether the camera tilts to point directly at the target
local function updateCamera()
if not target then return end
camera.Focus = target.CFrame
local rotatedCFrame = CFrame.Angles(0, math.rad(rotationAngle.Value), 0)
rotatedCFrame = CFrame.new(target.Position) * rotatedCFrame
camera.CFrame = rotatedCFrame:ToWorldSpace(CFrame.new(cameraOffset))
if lookAtTarget == true then
camera.CFrame = CFrame.new(camera.CFrame.Position, target.Position)
end
end
-- Set up and start rotation tween
local tweenInfo = TweenInfo.new(rotationTime, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut, rotationRepeatCount)
local tween = TweenService:Create(rotationAngle, tweenInfo, {Value=rotationDegrees})
tween.Completed:Connect(function()
tweenComplete = true
end)
tween:Play()
-- Update camera position while tween runs
RunService.RenderStepped:Connect(function()
if tweenComplete == false then
updateCamera()
end
end)
game.StarterGui.ScreenGui.TextButton.MouseButton1Click:Connect(function()
camera.CameraType = Enum.CameraType.Custom
script:Destroy()
end)
You can change the target part to the characters’ humanoidRootPart.
Edit: HumanoidRootPart, not Humanoid
How do I get humanoid root part, I replace the target variable to equal game.Players.LocalPlayer.Character.HumanoidRootPart
but now the whole script is broken.
Error message in outbox:
I figured it out!
Your helped because while I figured out how to get the HumanoidRootPart, you told me that I needed to get it!
Awesome! Let me know if you still need help.