generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Table help

Previous Thread :: Next Thread 
spearman2 is not online. 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
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
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 is not online. Preston99
Joined: 21 Sep 2008
Total Posts: 247
22 Jun 2013 12:42 PM
http://wiki.roblox.com/index.php/Table
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image