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

What does i and v mean?

Sorry, but I couldn't find anything anywhere telling me what i and v mean in scripts. Can you guys help?

2 comments

0

i is index and v is value

0

This Question has been answered multiple times; please use the Scripting Helpers' Search Engine to search for existing Questions. :)

2 answers

for I,v in pairs(game.Players:GetPlayers()) --The Value is all the players in the game and the players property.
      v:remove() --Kicks all the players in your server. So preety much like a shutdown script.
end

1 comment

0

Oh! I get it! Thanks! But, what's i for? I get what V does now.

I'll add on to what has been said above.

The pairs or ipairs function calls information from a table you have already made.

For example:

t = {1,2,"a","d",c = 12, q = 20} -- your table
for i,v in pairs(t) do
	print(i,v)
end

This would output to:

1 1
2 2
3 a
4 d
c 12
q 20

i and v are variables so you can change them to whichever you wish.

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