How would I script a player's camera to orbit their sky island?

I’m making a game and I have never scripted anything to do with camera manipulation. I’m trying to make the player’s camera orbit their sky island once their game loads until they click play (I can script that). I just need a script to smoothly make their camera rotate around their sky island and point a little down at it. TweenService or RunService, doesn’t matter.

Swiped this from a default template map in studio.

local RunService = game:GetService("RunService")
local Angle = 0
	
local CameraPosition = CAMERAPOSITIONHERE
	
RunService:BindToRenderStep("CameraMovement",Enum.RenderPriority.Camera.Value,function()
	local cameraPosition = CameraPosition + Vector3.new(50 * math.cos(Angle),20,50 * math.sin(Angle))
	Camera.CFrame = CFrame.new(cameraPosition, CameraPosition)
	Angle = Angle + math.rad(.25)
end)	
-- To stop the camera moving, RunService:UnbindFromRenderStep("CameraMovement")
-- Then change camera type back to "Custom"

Make sure you change “CameraPosition” to the part you want the camera to orbit around.

1 Like