So, when the user clicks, it makes another frame visible making itself invisible while at the same time display 4 random images. I have 1 image so far (I will be making the others later): images/http://www.roblox.com/asset/?id=146289136 I have got as far as this:
local PackPlayers = {"Nytroz", "Legendowski", "HypervenomPhantomz"}
numOfPlayers = 4
numOfPlayers meaning the maximum amount of images to display. Am I going about this correctly? And how would I continue? My previous code was this:
local PackPlayers = {"Nytroz", "Legendowski", "HypervenomPhantomz"}
numOfPlayers = 4
for i=1,numOfPlayers do
PackPlayers[i] = display.newImageRect("images/http://www.roblox.com/asset/?id=146289136", 200, 280)
PackPlayers[i].x = math.random(0, display.contentWidth)
PackPlayers[i].y = math.random(0, display.contentHeight)
end
I found it on the internet and tried to edit the syntax to work with Roblox LUA. But of course it didn't work. So I am asking you guys here to assist me.

25 comments
ImagesRect was part of Syntax from a different type Lua and thanks for your help. I appreciate it alot. And I can also add Id's to the first table?
Yes, you can, but the current code will not work. You will have to define in which GUI it should go (line 13) and what button is (line 16). I know what ImageRects are, but you don't need them for this. My point was that you were trying to use functions from a "display" table, which is nil in your current code!
Everything has been defined, and the size of each image is 200, 280. Where do I put that data in the code?
new.Size = UDim2.new(0,200,0,280)
And where would I put this? In the frame I want to make visible or in the button?
I would put the script into the ScreenGui itself, like this you don't get any strange issues on destroying images for example. Make sure that you update the references to the Gui and button.
http://ideone.com/0Mdtim, http://prntscr.com/2tfwfo PremPackOpen is where the 4 images should be displayed and where it says Script is the code you posted earlier
PremiumGP is also the button that activates the code
First of all: use a local script. Scripts won't work (yes, on local test mode, they will). new.Parent = script.Parent.Holder.PremPackOpen; put somewhere on top of the code button = script.Parent.Holder.GPackUI.PremiumGP
http://ideone.com/efhAcf So that will work now?
Yes, I think it should work. Go ahead and test it! :)
I didn't work, the imagebutton is unresponsive.
Oh wait, I know why. The frame where the images should be displayed in isn't in the code. Any way I could fix that?
It is in the code, that's where the "new" things go. Is PremiumGP an ImageButton?
PremiumGP is the ImageButton but in http://prntscr.com/2tfwfo PremPackOpen is where the images should be displayed
Does the output throw in any error?
I can't run the game in the output, it will just crash studio.
You can't check the output..!? (View --> output ?)
I can view it but the only things that show are: 22:10:34.386 - Http initialization M1 = 0x1061b90 M2=0x1061b94 22:10:49.586 - DataModel Loading http://www.roblox.com/asset/?id=146262208 logging probability 0.90560625019074 not logging 22:15:36.108 - Auto-Saving...
Wait, I fixed it! I missed out the 'S' in GPack(S)UI which caused the Output to throw errors.
But it is still staying I am trying to index global (nil) value
Wait, I was looking at the wrong scripts.
:O It works now! Thanks a million mate!
No problem at all! I hope you learned something from this! :)
Yep! I learned how to call data from a table and how to call certain functions.