Player character doesn't disappear when respawned

I don’t know if this topic fits the category but hopefully it does.

So, I’ve encountered quite an annoying bug (I don’t know if it’s really a bug)
I have this “bug” that when a player dies, the dead character does not despawn.

I absolutely no clue what could cause this.
Worst part is this happened in another of my projects:

If anyone has any idea how to fix this, please tell me.
This has been bugging me for days now.

(Deleting the character or setting it’s parent to nil does not work.)

P.S Sorry for the grammar issues, if there is any.

Uh, why are you creating a Folder for the Player? Could you show me your script which handles the “Clone_Player_in_Folder” function? There is a function in Player called CharacterAutoLoads.Turn this function on and optionally reduce the respawn time (in workspace) of the player. If I am wrong and there is a reason behind the “Clone_Player_in_Folder” function pls tell me!

I tried removing players from the folder and it worked, wow…
Also I don’t have a function named “Clone_Player_in_Folder”.

But I found the solution so I’ll mark it as it.
Thank you

1 Like

yes, did not mean that seriously ^^
Im curious, why were you cloning the players character into the folder?

1 Like

Honestly I forgot why I did, lol

If you want to keep player characters in the folder, you will have to manually remove the characters with a script that is connected to every death.

local debris = game:GetService("DebrisService")

game.Players.PlayerAdded:Connect(function(player)
    player.CharacterAdded:Connect(function(character)
        local humanoid = character.Humanoid or character:WaitForChild("Humanoid")
        humanoid.Died:Connect(function()
            debris:AddItem(character, 3)
        end)
    end
end

Something like that.

1 Like

:sweat_smile:, also check your game for viruses. I am not quite sure why your workspace name changes so many times. Go to your studio → go on the “View” section → open "Find All/Replace All and then type in keywords like:
getfenv
require
virus
hack
spread
If you find any words in scripts check if you made them, else delete the scripts. Also make sure you have no sus plugins in your studio :smiley:

1 Like

It’s an anti-cheat,
Changed names so exploiters have to use game:GetService(service) instead of game.Service
Example:

game:GetService("ReplicatedStorage") instead of game.ReplicatedStorage

1 Like

Doesn’t this break ‘CoreScripts’ that rely on indexing services via the dot operator?

¯_(ツ)_/¯

(character limit _____)

local Game = game
local Debris = Game:GetService("Debris")
local Players = Game:GetService("Players")

local function OnPlayerAdded(Player)
	local function OnCharacterAdded(Character)
		local function OnHumanoidDied()
			Debris:AddItem(Character, Players.RespawnTime)
		end
		
		local Humanoid = Character:FindFirstChildOfClass("Humanoid") or Character:WaitForChild("Humanoid")
		Humanoid.Died:Connect(OnHumanoidDied)
	end
	
	Player.CharacterAdded:Connect(OnCharacterAdded)
end

Players.PlayerAdded:Connect(OnPlayerAdded)

how do i make this bug work, i want to keep the player after death, i tried putting character in folder but that didnt work, if i enable the auto load character feature then the player will never respawn

nvm u can do it using this order but loadcharacter delays so the player is invisible for a bit, if u make it so loadcharacter doesnt delay the script then the order will break and it wont work, so best option is to clone n adjust the cloned character to look like nothing happened

local character = workspace.Character
workspace.Character.Parent = nil
game.Players.Character:LoadCharacter()
character.Parent = workspace