Hello, So I have made a solar system game I have been trying to make/fix this issue for a while okay so what I’m trying to do is make the camera (player’s view) able to view and follow the moving planet (Part) I have already made the camera but couldn’t figure out how the camera would keep following the planet as it moves i’ve tried making the camera have the same movement as the planet (part) but it still wouldn’t work here’s the script that allows the planet(part) to move
x = 90
while true do
wait(0.05)
script.Parent.CFrame = script.Parent.CFrame * CFrame.fromEulerAnglesXYZ(0, math.pi/x, 0)
end
this is what a planet looks like
i’ve tried adding the script of the rotation into the camera but it sill wouldn’t work how can i fix this?
local planet = -- path to ur planet
local camera = workspace.CurrentCamera
camera.CameraType = Enum.CameraType.Scriptable
while task.wait() do
local startpoint = planet.Position + Vector3.new(0,planet.Size.Y,planet.Size.Z)
camera.CFrame = CFrame.new(startpoint,planet.Position)
end
local RunService = game:GetService("RunService")
local camera = workspace:WaitForChilds("Camera")
local planet = -- path to ur planet
camera.CameraType = Enum.CameraType.Scriptable
RunService.RenderStepped:Connect(function()
local startpoint = planet.Position + Vector3.new(0,planet.Size.Y,planet.Size.Z)
camera.CFrame = CFrame.new(startpoint,planet.Position)
end)
Ok so what you would want to do, is make a remoteEvent in ReplicatedStorage, and then when you want the planets to start orbitting you fire it from server. Then you receive it on the client and you run the code. You want the receiver code to be in StarterPlayerScripts.