So I got this script for wiki.roblox, and I had a few questions I'm hoping you can answer:
First of all, here is the script:
local target = CFrame.new(0 , 50, 0)
for i, player in ipairs(game.Players:GetChildren()) do
if player.Character and
player.Character:FindFirstChild("HumanoidRootPart") then
player.Character.HumanoidRootPart.CFrame = target + Vector3.new(0, i * 5, 0)
end
end
And here is the link to the website: <http://wiki.roblox.com/index.php?title=Teleporting_Within_a_Place
So here is my first question:
What does the i stand for? It seems to me like it is a variable that goes up by 1 every time the loop repeats, is that correct, or is it something else?
What does the player stand for? Is it like a parameter that references the function that is written inside the loop? That's what I think, but I'm not certain.
What is the difference between
ipairsandpairs? This I have no idea what they mean.Finally could you say
target + CFame.new(0, i * 5, 0)or do you only use the one or the other. I know that you need to use CFrame to teleport a player without killing them, but do you ever need to use Vector 3?
I hope you can help me, and know that answering these would be a lot of work, so if you can it is very much appreciated. Thank you for your time and have a nice day.

2 comments
ipairs can loop through dictionaries
Yes, if the value has integer keys.