Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Place players into Folder?

I want to add the players in a folder inside workspace for when they first join and so on. What am I doing wrong?

local plrFolder = game.Workspace:WaitForChild("PlrFolder")
game.Players.PlayerAdded:connect(function(plr)
	plr.Character.Parent = plrFolder
end)

1 comment

0

Why are you placing the player into a folder? First of all since the player just joined you have to yield until the player spawns with plr:WaitForChild("Character").

2 answers

First off, there is a property in Players called CharacterAutoLoads. You could change this to false if you don't want the character to load. Second, Character is a property of player, not a child. The player's character refers to the model in the Workspace that shows you. So, the character's parent is Workspace.

1 comment

0

But what I'm saying is I'm trying to change their parent to the folder.

When a player joins, their character isn't immediately loaded. That is why we must use CharacterAdded.

CharacterAdded is an event that is fired whenever a player's character is created. It can be used in this context like so:

local plrFolder = game.Workspace:WaitForChild("PlrFolder")
game.Players.PlayerAdded:connect(function(plr)
	plr.CharacterAdded:connect(function(char)
		char.Parent = plrFolder
	end)
end)

If you need anymore help, feel free to ask!

This discussion is preserved as it was. New answers, comments, and votes are closed.