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

How to properly assign a player's character to a folder in the workspace?

I need a system to automatically put a player's physical character into a folder called "Spectating" once they join. I've tried this but it doesn't seem to be working. I have a feeling I may be using the wrong format.

function onCharacterAdded(character)
	character.Parent = workspace.Spectating
end

There's nothing showing up in Output about character being a nil value so I really don't know.

1 answer

✓ Accepted answer

Try to make a script in SSS, with this line of code.

game.Players.PlayerAdded:Connect(function(player)
wait(2)
player.Character.Parent = workspace.Spectating
end)

You have to actually connect the function to something, which in that case is detecting if a Player joined, and when that happens, the function fires. Hope I helped!

4 comments

0

I got an "attempt to index nil value with Parent" error. How should I fix this?

0

Try this, I changed the answer.

0

Ok, this will work, all you have to do is add a delay. :D

0

The delay worked!

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