Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

LocalScript to change CameraSubject not working right, what is wrong???

In my game, I need the camera to focus on the morph instead of the HumanoidRootPart. When my local script for the camera runs, the camera just stays in place. What is going on?? LocalScript:

local player = game.Players.LocalPlayer
local character = player.Character

game.ReplicatedStorage.Status.Changed:Connect(function(newstring)
	if newstring == "Game in progress." then
		wait()
		
		workspace.CurrentCamera.CameraType = Enum.CameraType.Scriptable
		workspace.CurrentCamera.CameraSubject = character:FindFirstChild("Morph")

	end
end)

11 comments

0

use workspace.CurrentCamera

0

0 what is Status? A string object? Delete the line that changes your camera to custom

0

is "Morph" a model or part?

0

Model

0

But it doesn't error

0

I also tried manually setting the camera subject and it orked

0

You cant focus the camera on a model, it needs to be a part.

0

worked

0

Yes, you can. So, it worked fine and set the subject, but the camera just hovered there. I think its because the type is still scriptable???

0

make the model have a primary part (in the properties of the model) and set the camerasubject to model.PrimaryPart

0

Still didn't work

1 answer

✓ Accepted answer
local player = game.Players.LocalPlayer
local character = player.Character

game.ReplicatedStorage.Status.Changed:Connect(function(newString)
    if newString == "Game in progress." then

		--Make the camera point to the morph inside the player if we find the morph
		if(character:FindFirstChild("Morph") and character.Morph.PrimaryPart)then
        	workspace.CurrentCamera.CameraSubject = character.Morph.PrimaryPart
		end

    end
end)

3 comments

0

N, it works fine until that point, but when it changes the camera it glitches and makes the camera like relly far away.

0

do you still have the line of code that changes the camera type to Custom?

0

No, I put my new code in the question

This discussion is preserved as it was. New answers, comments, and votes are closed.