The local script breaks when the player dies. Is there a way to make the script not be deleted on death?
I will say right away - I need to insert the script into the player from the server.
I’ve been trying to fix it for about 3 hours… I’ve tried - pasting into a character, pasting into the GUI…
I’m making a map for some game, and for optimization I use local scripts that control models, creatures, etc. As the player dies, local scripts disappear, local objects break.
Is this script being cloned into the player’s character that you’re trying to achieve? I’d say there’s no way of not having it be deleted on death since, when the player fully dies and then respawns, the player’s character will be recreated into its original state.
What you could do, though, is put the script in StarterCharacterScripts OR connect a Player.CharacterAdded event to the server script that’s cloning the local script to clone the local script whenever the character is being added. (respawned)
Seems like you didn’t put your script in it’s belonged folder, it’s called StarterCharacterScripts or StarterPlayerScripts, both of these are located in StarterPlayer Folder.
Or your script runs before the Character even loads, do this instead:
local Character = YourPlayerVariable.Character or YourPlayerVariable.CharacterAdded:Wait()