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

How do you get a character from a player table?

For example using a for pairs loop like this:

for i, v in pairs(game.Players:GetPlayers()) do

How would i get the character of variable v

I understand it is such a simple question. Even a wiki link would be helpful if there is one :)

1 answer

✓ Accepted answer
for index, plr in pairs(game.Players:GetPlayers()) do
	local char = plr.Character or plr.CharacterAdded:wait() -- The 'or' is for when the character is dead or hasn't spawned yet
end

2 comments

0

Thank you!

0

Np :)

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