Setting different camera subject removes local transparency on camera change

I’d like to change the default CameraSubject from the Humanoid to a custom camera part I have created and for all the default roblox camera scripts to function as intended.

But changing the CameraSubject from anything other than a Humanoid will remove the character becoming transparent when moving the camera into first person.

I’ve tried looking into the default camera scripts but to no avail. The Camera Part is a transparent part welded to the UpperTorso with a Motor6D

Going into first person with the CurrentCamera.CameraSubject set to the Player’s Humanoid:


Going into first person with the CurrentCamera.CameraSubject set to my custom CameraPart:

In the “TransparencyController” under the CameraModule of the PlayerModule, when you set your CameraSubject, TransparencyController:SetSubject() is called; by default, the controller will only apply a transparency when the CameraSubject is a Humanoid or occupied VehicleSeat.

To maintain transparency on the local character, you can either fork the SetSubject method or apply the LocalTransparencyModifier yourself from a different script. There may be other options as well depending on what your camera system does and doesn’t need to do.

I assume you’re talking about this function

function TransparencyController:SetSubject(subject)
	local character = nil
	if subject and subject:IsA("Humanoid") then
		character = subject.Parent
	end
	if subject and subject:IsA("VehicleSeat") and subject.Occupant then
		character = subject.Occupant.Parent
	end
	if character then
		self:SetupTransparency(character)
	else
		self:TeardownTransparency()
	end
end

I changed line 3 in this function (line 132 in the full TransparencyController module) to just

if subject then

And it still didn’t do anything

It ultimately depends on what character gets set to. If all you changed was that line, then where within the within the hierarchy is your camera part parented? If it is a direct child of the player’s character, it should be working.

image
It is indeed a child of the player’s character

Then the only other thing I could suggest is verify that the forked version of the script is the one that’s running. If I paste a fresh copy of the PlayerModule into StarterCharacterScripts and edit the one line how you have it, it seems to function as intended.

Here is a screenshot where I’ve parented the SpawnLocation to my character and am using it as the CameraSubject:

1 Like

I had the PlayerModule parented to a LocalScript which handles all the module loading and it was indeed creating a copy. Thank you very much!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.