When I try Set Character Parent to Folder, it gives warn "... Current parent is Workspace."

code:

game:GetService("Players").PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(character)
		character.AncestryChanged:Wait()
		character.Parent = workspace.Characters
	end)
end)

Warn Message:
Something unexpectedly tried to set the parent of xcosanxc to Characters while trying to set the parent of xcosanxc. Current parent is Workspace.

is there a line number for this error

understandable what the error is.

line 4

You’re setting it to quick.

I think if you just put a wait() you should be fine.

It should be like:

game:GetService("Players").PlayerAdded:Connect(function(plr)
  plr.CharacterAdded:Connect(function(chara)
    wait(2)
    chara.Parent = game.Workspace.Characters
    end)
end)

but then I don’t need to add AncestryChanged:Wait() .
but i want the best performance.

not wait(2) thats just wait()

I use workspace:WaitForChild(chara.Name).Parent = Characters
but thats not best way I think.

Well, i’ve been using the platform for roughly 8+ years, it’s most likely that I’m aware this doesn’t seem very professional, but it will do the job fine.

I would say that is good enough, if this is what you meant

game:GetService("Players").PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(character)
		workspace:WaitForChild(character.Name).Parent = characterFolder
	end)
end)

It works, and it doesn’t wait longer than it needs to

I don’t know if this will work but you could try and use the ContentProvider service for this. Then just want for the characters assets to load. I doubt it will work but it’s worth a shot.

It could be that you are using the wrong event. Try usingCharacterApperanceLoaded instead.

but what if roblox changes that? doesn’t seem so perfect.

I think it’s better to change your place when you were born instead of asking if you are where you were born.

It didn’t work last time I tried.
you try? If it works on you, it means I made a mistake.

Well, I did some testing and I find that it is probably to do with how Roblox loads the characters. It seems that loading the character.

In the end I did manage to get the thing working.

local Players = game:GetService("Players")

local Characters = workspace:WaitForChild("Characters")

local RESPAWN_TIME = Players.RespawnTime

Players.CharacterAutoLoads = false

Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(character)
		local humanoid = character:FindFirstChild("Humanoid")
		task.wait()
		character.Parent = Characters
		if humanoid then
			humanoid.Died:Connect(function()
				task.wait(RESPAWN_TIME)
				player:LoadCharacter()
			end)
		end
	end)
	player:LoadCharacter() 
end)

The other stuff isn’t necessary. Just the task.wait().

Something like this works too.

Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(character)
		task.wait()
		character.Parent = Characters
    end)
end)

but what if roblox changes that?

Change what, exactly?

I think it’s better to change your place when you were born instead of asking if you are where you were born

Sorry- I didn’t really get this part.

Anyway, this section of code doesn’t really look like it requires a lot optimization to me, as @koziahss said, just adding a wait() before setting the parent of character would work, and it won’t just suddenly break in the near future.

Replace

with: (I use this for my custom character loader)

repeat task.wait() until Character:IsDescendantOf(workspace)
Character.Parent = workspace.Characters

or for more general use:

Player.CharacterAppearanceLoaded:Wait()
Character.Parent = workspace.Characters

This happens because you are setting the .Parent too fast.
Simply add a task.wait() to solve it.

Is this still a problem for you? Recently I’ve had this problem multiple times and fixed it each time, but I don’t recall how I fixed it. If this is still an issue for you, I can look into it.

It’s not a problem for me, but if you can find the perfect code for it, let me know.

I think best way:

workspace:WaitForChild(character.Name).Parent = workspace.Characters

first change all files’ Name to:
__Camera
__Terrain

or put “_” to characters name

I’ve had this problem multiple times and fixed it each time, but I don’t recall how I fixed it.

As I said above:
This happens because you are setting the .Parent too fast.
Simply add a task.wait() to solve it.

Example:

local WorkspaceService = game:GetService('Workspace')

local function ChildAdded(Object)
	if (Object:IsA('Tool'))
	then
		Object:Destroy() -- -- Something unexpectedly tried to set the parent of (ToolName) to NULL while trying to set the parent of (ToolName). Current parent is Workspace.
	end
end

WorkspaceService.ChildAdded:Connect(ChildAdded)

Solution: Add a task.wait() before changing its .Parent or destroying it with :Destroy().


Pretty sure he forgot about his post as it’s been silent for a long time.
Hence, I’d assume he found a solution already.