How would I make sure that the camera attaches to the player?

i think so, the camera type does change from scriptable (another script) to custom, but it orbits a random spot everytime, its not attached, ive attached an image

to the player

Hey, do you mean lock the camera into the player’s position?

yea, you know when you join a game, the camera is locked onto the player (not trying to be passive agressive)

Wait, do you mean locked in first person?

no like the orbital around the player, 3rd person if you will

So it’s locked in third person. Right?

1 Like

All you have to do is click starter player:
image
Click the minimum zoom distance and set it to 128. There’s no scripting required for lock in first person or third person.

ok, my bad but I have like a little intro I set up, where when a player enters the game the camera is set to scriptable so it won’t move, I then need for the camera to be back set to custom or the orbital one so then the game is playable. Right now the camera is stuck a few feet behind the player (see photo below) while it can orbit, it orbits around a random point and does not follow the players movement in any way

Sorry for the misunderstanding

That’s all fine and I understand this is a difficult concept to explain especially when you were tired and it was night.

workspace.Camera.CameraType = Enum.CameraType.Scriptable
-- your code here --
workspace.Camera.CameraType = Enum.CameraType.Custom

Thanks, I already have a line

repeat wait()
			Camera.CameraType = Enum.CameraType.Custom
		until Camera.CameraType == Enum.CameraType.Custom

Wait, I don’t understand the point of the loop if your loop will break when the camera type is set to custom and your setting it to custom with no other code in it in the loop.

I stole it from another loop to make sure that the camera was being set to custom, heres that loop if you’re curios

repeat wait()
	Camera.CameraType = Enum.CameraType.Scriptable
	until Camera.CameraType == Enum.CameraType.Scriptable
	Camera.CFrame = workspace.CameraPart.CFrame

I think the problem might be in the gui. A gui doesn’t allow you to move your camera while your on the gui so a glitch might have happened while doing that and made the camera state hang(more specifically the state of the camera is unable to be changed because of the gui).

Ok, how would I fix that? Is it something that can be fixed?

Well, I’ve thought of adding a wait after changing the gui. That might be a good idea.

Ok, would I just add a wait(1) or wait() before the line that changes it?

Yep, I assume that would fix the problem.

Alright so I tried that and things lead to another and I made another script, heres that script:

local Camera = workspace.CurrentCamera
script.Parent.MouseButton1Click:Connect(function()
	local plr = game.Players.LocalPlayer.Name
	local player = game.Workspace:FindFirstChild(plr)
	Camera.CameraSubject = player.Humanoid
	
end)

I made a bigger problem, because that’s what I do. But now it made an output error:

ActivateCameraController did not select a module.

That came from the camera module, btw

Oh yea forgot the wait() before the gui changing didn’t work, sorry about that

local Camera = workspace.CurrentCamera
script.Parent.MouseButton1Click:Connect(function()
	local plr = game.Players.LocalPlayer.Name
	local player = game.Workspace:FindFirstChild(plr)
	Camera.CameraSubject = player.Humanoid
end)

This code has a few problems. First of all, when you’ve referenced plr, you’ve referenced the name. Second of all, you are not referencing the character at all.

Here’s your improved code:

local Camera = workspace.CurrentCamera
script.Parent.MouseButton1Click:Connect(function()
	local plr = game.Players.LocalPlayer
local character = plr.Character or plr.Character:Wait()
	Camera.CameraSubject = character.Humanoid
end)
1 Like

thank you, I tired to put this in a seperate script so thats why I was a bit late to accept it.
heres a dog picture I found on the internet