Cant grab players from Workspace

My goal is to take the players and move them into a folder that’s in Workspace. With this code it cant find my player in workspace even when it checks for the player. The
Sad
Workspace
yaeew

Why don’t you loop through all of the players, and then get their character that way?

2 Likes

Put this code in a LocalScript inside of StarterCharacterScripts

local Players = game:GetService("Players")
local Player = Players.LocalPlayer

local WS = game.Workspace
local Folder = WS.Players -- Change Players to the name of your Folder

if Player then 
	script.Parent.Parent = Folder
end

That will only work on the client side, not the server side.

1 Like

What do you mean? Works fine for me
image

You are not changing the explorer to the server side view. It works fine on the client, but the server doesn’t see it.

1 Like

Client
When you run it click here and then check if you were moved

1 Like

Apologies, I am quite tired. In that case I dont think this is possible.
Workspace its self is already a “Folder” in a way so I dont see much reason in changing that

I believe it is for organization purposes

Although this is marked as solved, the only script that has been posted is clientside-only; Here’s what my game does in its CharacterAdded server script to move players into a Players model:

-- If the Player's Character loaded, re-parent it if it's not located in Players.
	if _playerCharacter.Parent then
		if _playerCharacter.Parent == workspace then
			task.wait(1.0)
			print(PlayerReference.Name .. "'s Character wasn't located in workspace.Players. It should be moved.")
			_playerCharacter.Parent = workspace:WaitForChild("Players",5)
			PlayerReference.Character = _playerCharacter
			-- print("Its parent is now " .. _playerCharacter.Parent.Name .. ".")
		end
	end

There’s one good use for putting all players in a model/folder: character outlines; Highlight instances have a weird limit of 31 being used anywhere at a time, so placing that in a “players folder” gives all players an outline with just one instance.