I’ve also done some quick tests to see how it works when it comes to garbage collection. Local humanoid = character:WaitForChild("Humanoid") Player.CharacterAdded:Connect(function(character) Players.PlayerAdded:Connect(function(player) local Players = game:GetService("Players") Once the new character spawns, reference should be finally lost. You may also want to take care of the camera, because it stays focused, which means the reference to the old character is kept by default scripts even after it’s subject to :Destroy(). So you can simulate this by setting player.Character to nil, waiting a reasonable time, and then calling :Destroy() on the old model before deciding to load the character again in the near future. LoadCharacter() clears the old character from workspace before a new one is assigned. Apparently some default scripts still work on the character while player.Character exists.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |