LocalScripts stop running after respawning

Hello. So I have this “habit” of storing any camera/gui related LocalScripts inside of StarterGui, character related LocalScripts in StarterCharacterScripts and player related LocalScripts inside of StarterPlayerScripts.
Most of them work, but today I made a script that tweens the camera’s cframe to a part in the workspace, waits a few seconds, and then tweens the camera back to the player and since it’s related to the camera, I put it inside of StarterGui.
The issue is, if the player respawns while those few seconds of waiting are in progress, the script does not tween the camera back to the player’s head’s CFrame, but just stays in place. Same happens for a script that I have in StarterGui, which makes the player’s camera tilt 30 degrees when they’re damaged, but if they respawn while the tween for the tilt is happening, the camera stays tilted until the player rejoins.

I’ve seen someone post something like this before, and their solution stated, that they moved their script from StarterGui to StarterCharacterScripts and it worked even if the player died during the “cutscene”, so I tried that, but there’s the same results. Same happens for StarterPlayerScripts. How could I possibly fix that and make the code run regardless of the player respawning?

Where did you put the script? Literally inside a ScreenGUI or inside a StarterGUI, StarterCharacterScripts or StarterPlayerScripts?
If it’s inside a ScreenGui you can try disabling ResetOnSpawn.
If it’s inside StarterGUI, StarterCharacterScripts or StarterPlayerScripts you may send the script itself so I can see what’s the problem. You’re free to send