:LoadCharacter() Issue

So, I was trying to create custom deaths in my game, which used :LoadCharacter() after a NumberValue’s value in the character reaches 0. I had a camera script that followed the HumanoidRootPart’s CFrame, and it stopped working after I used :LoadCharacter(). This camera script was stored inside the backpack.

Here’s a gif of it working (before I used :LoadCharacter()):
https://gyazo.com/a44b00691655933f6580af3ea133731c

and here’s a gif of the camera script not working (after I used :LoadCharacter()):
https://gyazo.com/2d911b9efab7f5d6c841cb8ef874935a

I honestly couldn’t think of any solutions, I was thinking that it wasn’t working because LoadCharacter() doesn’t reload scripts stored in the backpack, or in the player? How would I get around this issue?

The backpack deletes and refreshes anything in it. Additionally make sure to re-reference the character when it spawns back in.

Here:
Player.CharacterAdded

Edit: try to use internal variables and a non-deleting script. It’ll run cleaner for you.

I can almost guarantee you that LoadCharacter is not the issue. I smell an XY Problem.

That being said,

The PlayerScripts folder superseded using the backpack as a container for LocalScript code.

Are you trying to ensure that your code does or does not reload on death? If not, move your code to StarterPlayerScripts (which will be transferred to PlayerScripts). If you are, you’re going to need a different implementation. For example, you could put this LocalScript inside the character via StarterCharacterScripts.

You could honestly just parent it to the Character itself, and have it work that way. Just put a new script in when they respawn.