CameraSubject Not Setting To New Humanoid

Hey all, good day to you. I was going to make a Custom Character Switching System between 2 different characters, however whenever I attempt to set the Player’s camera to be the new Humanoid of the player, it does not work. I’ve tried waiting a few seconds, but still nothing. I have become frustrated with this and am very confused as to why this doesn’t work.

ServerScript:

LocalScript:

Try removing player.Character:Destroy() in ServerScript at line 31, Roblox automatically removes your last character when changed.

Thank you for that tip, much appreciated! However, it still does not change the CurrentCamera of the Player to the new character.

No problem, but instead of using remote events to change the camera, try removing them and adding this to your LocalScript:

local player = game.Players.LocalPlayer

player:GetPropertyChangedSignal("Character"):Connect(function()
	if player.Character then
		game.Workspace.CurrentCamera.CameraSubject = player.Character:FindFirstChild("Humanoid")
	end
end)

I just tried it, however it still did not fix my problem. I have no idea what’s going wrong with these scripts…

Does the console log shows any errors?

Nope, there are 0 errors shown in the output. It’s weird, however because if I set the camera manually using the Command Bar it works.

I think I know what’s happening here. Try passing the new character’s humanoid as a parameter in the remote event function and then set the camera subject as it.

This function probably executed during the transition when the character was switching.

That didn’t work either, but I think I have a better understanding. I just tried to print something in the RemoteEvent function, however it did not print. This means that A, the RemoteEvent is firing but the client isn’t picking it up, or B, that the client picks it up but isn’t firing the function.

Yes, by the way, where is your local script located?

It is located in the StarterGui.

That’s weird, I tested this code in Studio and it worked perfectly, send me a picture of the script that fired SetCamera event.

Send me the client part now.

()

Have you tried printing game.Players.LocalPlayer.Character in the remote event function?

Yes, I’ve tried printing a lot of things but they never show up in the Output.

Have you tried putting these events in StarterPlayerScripts? I don’t know how does your system works, but I’m pretty sure the error envolves the script location.

1 Like

You were right, I just put a LocalScript in StarterPlayerScripts and it worked! Thank you so much, I bid you a goodnight/day!

1 Like