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
 

Number of guis based on table?

Previous Thread :: Next Thread 
xiaoxiao181 is not online. xiaoxiao181
Joined: 14 Aug 2008
Total Posts: 5882
03 Aug 2013 05:59 PM
This is the function combo written by galaxen, a guy who helped me learn what scripting i know nowadays, though he doesn't get on anymore that ive seen, so i cant exactly ask him.

i know what the function does, I just don't understand how it works. I need to understand it if I plan on using a similar process to create an inventory gui for Lodeka.

Can anyone help me to understand this completely and thoroughly?

function Gui(Class,Name,Parent,Size,Position)
F = Instance.new(Class)
F.Name = Name
F.Parent = Parent
F.Size = Size
F.Position = Position
return F
end

function DropDown1(Class,Size,Position,Name,Parent,Table)
Base = Gui("Frame",Name.."Base",Parent,Size+UDim2.new(0,0,#Table*0.02,0),Position)
T = {}
for i=1,#Table do
Other = Gui(Class,Name..i-1,Base,UDim2.new(1,0,1/#Table,0),UDim2.new(0,0,(1/#Table)*(i-1),0))
Other.Text = Table[i].Name
C = Instance.new("ObjectValue")
C.Name = "Class"
C.Value = Table[i]
C.Parent = Other
T[#T+1] = Other
end
return Base,T
end
Report Abuse
xiaoxiao181 is not online. xiaoxiao181
Joined: 14 Aug 2008
Total Posts: 5882
03 Aug 2013 06:03 PM
Actually I think it's this function that creates the text buttons.
I know one of them creates a number of TextButtons based on how many items were listed in the table, in this game's case it was the number of towers in the BuildMap, the model holding all the towers from Lighting.


function DropDown2(Class,Size,Position,Name,Parent,Tower,Upg)
Base = Gui("Frame",Name.."Base",Parent,Size+UDim2.new(0,0,0.02,0),Position)
T = {}
for i=1,2 do
Other = Gui(Class,Name..i-1,Base,UDim2.new(1,0,1/2,0),UDim2.new(0,0,(1/2)*(i-1),0))
if i == 1 then
if Upg ~= nil then
if Cash.Value < Upg.Cost.Value then
Other.BackgroundColor3 = BrickColor.new("Bright red").Color
Other.Text = "Can't afford the "..Upg.Name.." ("..Upg.Cost.Value.." "..Upg.Cost.CostName.Value..")"
else
Other.BackgroundColor3 = BrickColor.new("Bright green").Color
Other.Text = "Upgrade to "..Upg.Name.." ("..Upg.Cost.Value.." "..Upg.Cost.CostName.Value..")"
Other.MouseButton1Click:connect(function()
P = Tower.Parent
Tower:Remove()
Copy = Upg:Clone()
Copy.Parent = P
Place(P,Copy.Foot)
Cash.Value = Cash.Value-Upg.Cost.Value
P.Ocup.Value = true
Base:Remove()
end)
end
else
Other.BackgroundColor3 = BrickColor.new("Bright red").Color
Other.Text = "Upgrade isn't available"
end
else
Other.BackgroundColor3 = BrickColor.new("Bright green").Color
if Tower.Type:findFirstChild("Normal") then
Other.Text = "Sell for "..Tower.Cost.Value.." "..Tower.Cost.CostName.Value
Other.MouseButton1Click:connect(function()
P = Tower.Parent
P.Ocup.Value = false
Cash.Value = Cash.Value+Tower.Cost.Value
Tower:Remove()
Base:Remove()
end)
else
Other.Text = "Sell for "..(Tower.Cost.Value/2).." "..Tower.Cost.CostName.Value
Other.MouseButton1Click:connect(function()
P = Tower.Parent
P.Ocup.Value = false
Cash.Value = Cash.Value+Tower.Cost.Value/2
Tower:Remove()
Base:Remove()
end)
end
end
T[#T+1] = Other
end
return Base,T
end
Report Abuse
R1L is not online. R1L
Joined: 26 Jun 2013
Total Posts: 372
03 Aug 2013 06:58 PM
function R1L(Class,Props)
Object = Instance.new(Class)
for i,v in pairs(Props) do
Object[i]=v
end
return Object
end
R1L("Part",{Parent = workspace,
Name = "Hax",
formFactor = "Custom",
Size = Vector3,new(50,50,50),
BrickColor = BrickColor.new("Really black"),
})
Report Abuse
xiaoxiao181 is not online. xiaoxiao181
Joined: 14 Aug 2008
Total Posts: 5882
03 Aug 2013 07:02 PM
I'm assuming that's some sort of trolling. Doesn't exactly work if I don't get the joke.

Either way it doesn't help me understand how this function works.
Report Abuse
R1L is not online. R1L
Joined: 26 Jun 2013
Total Posts: 372
03 Aug 2013 07:05 PM
--Table number
table.maxn(Table)
Report Abuse
xiaoxiao181 is not online. xiaoxiao181
Joined: 14 Aug 2008
Total Posts: 5882
03 Aug 2013 07:22 PM
Dude, wtf are you talking about? You're not helping. All you're doing is confusing me more. You're not explaining how it works.
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