The Issue:
When a player’s character is created again from death, the user’s PlayerScripts
removes scripts that were initially replicated from the server. What I mean by this is the following:
- Place a
LocalScript
into a player’sPlayerGui
on the server-side. - Within that
LocalScript
re-parent the script toPlayerScripts
, on the client-side. - When the character respawns, this LocalScript gets destroyed for some reason.
Why I Need This:
I have the server deciding on appropriate scripts to send to the client from a library. As such, I’d like this to be done during run-time for simplicity in my use case.
Behaviour I Expect:
Scripts inside of PlayerScripts
should not be removed when the player’s character respawns. This is understandable behaviour for CharacterScripts
, but not PlayerScripts
however.
Reproduction:
ReplicationTest.rbxl (15.2 KB)
- Read over the scripts inside of
ServerScriptService
to gain a better understanding of what is going on. - Launch play-solo.
- If you look in your
PlayerScripts
, theLocalScript
from the server is there. - Set your character’s humanoid health to 0.
- The
LocalScript
inside of yourPlayerScripts
has been destroyed.