How to make camera focus on a certain model?

I want to make a menu screen for my game and in order for it to work, I need it to focus on it and spin around a model.

How could I do this?

1 Like

Will CFrame.lookAt() help? API is documented here.

This will probably help you in making it orbit around a model.

1 Like

Pretty, easy, camera manipulation.

-- Place this script inside serversciptservice
-- Create a remote and place it inside replicatedstorage.

local Remote = game.ReplicatedStorage:WaitForChild("RemoteEvent")

game.Players.PlayerAdded:Connect(function(plr)
Remote:FireClient(plr)
end)

Then, place this script inside startergui / starterplayer > startercharacterscripts



game.ReplicatedStorage.RemoteEvent.OnClientEvent:Connect(function()

	local camera = workspace.CurrentCamera
	camera.CameraType = Enum.CameraType.Scriptable
	local Part = workspace.camera1
	camera.CFrame = Part.CFrame
end)

Why are you firing a remote from the server for when the player joins, and then putting the code into starterCharacterScripts? If anything the script wont even be replicated, meaning nothing picks it up. You can simply just do

local camera = workspace.CurrentCamera
camera.CameraType = Enum.CameraType.Scriptable
local Part = workspace.camera1
camera.CFrame = Part.CFrame

It’s literally a simplier way of doing it besides, it’s giving them some knowledge on remote events too :man_shrugging:

also adding onto this, it was a quick script I made with little time, like I’m talking about a minute, and the code still does work so I don’t seek why there is an issue with it, although I do see your point it could’ve been the way that you provided. I still seek that if they are new to learning programming that would be the correct direction to go while them learning about remote events and what not.

Let’s also not clutter this post with any-other comments as the solutions have been provided above, and the point that you are providing is a good one although the code still works above and this conversation / debate that we are having can be put to an end. @Benified4Life

The way you’re doing it has 2 scripts, a remote and events. The way I’m doing it has 1 script, less code and actually works 100% of the time. I know it’s important to learn about Remotes but learning it wrong just puts them further behind overall. A remoteEvent is not needed here. Just putting the code in starterCharacter would work fine.

I understand it may clutter however I believe it’s important discussion to have.

2 Likes

How will the camera be spun?
Mouse movement?
Automatic spinning?
Something else?

Do you want the camera to automatically spin around the model or do you want the player to be able to move the camera as it focuses on the model?