spearman2
|
  |
| Joined: 28 May 2010 |
| Total Posts: 2938 |
|
|
| 22 Jun 2013 12:36 PM |
So I'm making an obby; so it'll enter their names in the table when they finish only if they are the 1st, 2nd, and 3rd to finish said obby. But I'm having trouble with the table part, since is my first attempt at this so can someone help me
winners = {} brick = script.Parent
function enter(plr) table.insert(winners, plr.Name) local h = Instance.new("Hint", plr:FindFirstChild("PlayerGui")) h.Text = "Congrats you have finished!" game:GetService("Debris"):AddItem(h,2) end
function finished(hit) if hit.Parent:FindFirstChild("Humanoid") then local player = game.Player:GetPlayerFromCharacter(hit.Parent) for i,v in pairs(winners) do if i < 4 then enter(player) elseif i == 3 then local h = Instance.new("Hint", game.Workspace) h.Text = "The winners are "..table[winners]..".".." Congrats." --Idk, I know this part wrong game:GetService("Debris"):AddItem(h,2) else return false end end end end
brick.Touched:connect(finished) |
|
|
| Report Abuse |
|
|
| 22 Jun 2013 12:42 PM |
I think this would work:
h.Text = "The winners are " .. table.concat(winners, ", ") .. ". Congrats."
Also, that block wouldn't fire because you already checked if i is less than 4, and since 3 is less than 4, it would satify that if and would not continue to the elseif.
|
|
|
| Report Abuse |
|
Preston99
|
  |
| Joined: 21 Sep 2008 |
| Total Posts: 247 |
|
|
| 22 Jun 2013 12:42 PM |
| http://wiki.roblox.com/index.php/Table |
|
|
| Report Abuse |
|