Preventing Errors When Removing Character

  1. What do you want to achieve?

    I am making a custom camera system in which there is no need for the default character. I would like to cleanly remove the player’s character, however this cannot be done without destroying all children of the baseplate. (For more context, visit this earlier post: How can I delete the player character? - #36 by neweve2323). If there is a way to do this correctly then that is far preferred, but if not I would just like to make the players character an anchored part without the “Health” and “Animate” scripts.

  2. What is the issue?

    I have been able to achieve the latter solution listed above but I still receive infinite yield warnings from the server and such. This is definitely not a huge issue that affects gameplay in any way, I’m just open to better ways to do this.

  3. What solutions have you tried so far?

  • Deleting Character when player joins: destroys all children of baseplate
  • Setting StarterCharacter: still has Health and Animate scripts
  • Deleting scripts inside StarterCharacter: still yields errors such as "Infinite yield possible on ‘Torso’ because the StarterCharacter does not have such an instance
  • Banging my head against the wall

Thank you so much! :))

1 Like

Just spitballing but you can set the Player.Character value. Maybe try setting it to something else or nil? Then you should be able to delete the character.

local ps = game:GetService("Players")
ps.PlayerAdded:Connect(function(plr)
     local character = plr.Character
     plr.Character = nil
     character:Destroy()
end)
1 Like

you can go to settings and disable Character auto load

1 Like

Where would this setting be located? Does it need to be done via script?

1 Like

it’s either on workspace or on starter player or starter character folder
look into their properties

1 Like

The most similar setting to the one described is “LoadCharacterAppearance”, and when it is disabled the player spawns as a dummy.

1 Like

Since you are setting it to nil previous to destroying it, it does not destroy it I believe.

1 Like

If the problem is an infinite yield, simply add a timeout in the second parameter, then return in the function if the variable containing the character instance is nil.
(Assuming you are checking for the character in a function)

1 Like

These are uneditable scripts embedded in Roblox that produce the errors.

1 Like

I think i’ll go bang my head against a wall for a bit too and think

1 Like

real man, real. again if it can’t be helped its literally fine, theres a ton of stuff i need to work on in the meantime

1 Like

the character variable is the character model loaded into memory. it’s not Player.Character.

Ah, sorry, I was not clear. I tested the code previous to sending that, and it unfortunately did not fix it. I probably should have said that in addition to my speculation as to why it did not work as intended.

image

See if this is relevant for you

Oddly enough, this too causes the map to despawn.