|
| 05 Jun 2016 03:01 PM |
Cards = {425693490,425702520,425703997,425704061,425704795,425705486}
local Imagelabel1 = script.Parent.ScreenGui.CardFrame.ImageButton local Imagelabel2 = script.Parent.ScreenGui.CardFrame2.ImageButton
Imagelabel1.Image = Cards[math.random(1, #Cards)] Imagelabel2.Image = Cards[math.random(1, #Cards)]
Imagelabel1.Image = "rbxassetid://"..Cards Imagelabel2.Image = "rbxassetid://"..Cards
It just leaves the image blank. |
|
|
| Report Abuse |
|
|
|
| 05 Jun 2016 03:03 PM |
Cards = {425693490,425702520,425703997,425704061,425704795,425705486}
local Imagelabel1 = script.Parent.ScreenGui.CardFrame.ImageButton local Imagelabel2 = script.Parent.ScreenGui.CardFrame2.ImageButton
math.randomseed(6) Im1 = Cards[math.random(1, #Cards)] Im2 = Cards[math.random(1, #Cards)]
Imagelabel1.Image = "rbxassetid://"..tostring(Im1) Imagelabel2.Image = "rbxassetid://"..tostring(Im2)
#code mod = require(sike) if not mod.xThe[...] then print("You're not RbxDev yet..") end |
|
|
| Report Abuse |
|
|
|
| 05 Jun 2016 03:06 PM |
| thanks! But how come when I click test it gives me the same card over and over |
|
|
| Report Abuse |
|
|
|
| 05 Jun 2016 03:07 PM |
play around with the name in randomseed change it to something like math.randomseed(math.random(1,math.random()))
#code mod = require(sike) if not mod.xThe[...] then print("You're not RbxDev yet..") end |
|
|
| Report Abuse |
|
|
|
| 05 Jun 2016 03:08 PM |
I added more images and it broke :/ Cards = {425693490,425702520,425703997,425704061,425704795,425705486}
local Imagelabel1 = script.Parent.ScreenGui.CardFrame.ImageButton local Imagelabel2 = script.Parent.ScreenGui.CardFrame2.ImageButton local Imagelabel3 = script.Parent.ScreenGui.CardFrame3.ImageButton local Imagelabel4 = script.Parent.ScreenGui.CardFrame4.ImageButton
math.randomseed(12) Im1 = Cards[math.random(1, #Cards)] Im2 = Cards[math.random(1, #Cards)] Im3 = Cards[math.random(1, #Cards)] Im4 = Cards[math.random(1, #Cards)]
Imagelabel1.Image = "rbxassetid://"..tostring(Im1) Imagelabel2.Image = "rbxassetid://"..tostring(Im2) Imagelabel3.Image = "rbxassetid://"..tostring(Im3) Imagelabel4.Image = "rbxassetid://"..tostring(Im4) |
|
|
| Report Abuse |
|
|
|
| 05 Jun 2016 03:13 PM |
math.randomseed(math.random()) Cards = {425693490,425702520,425703997,425704061,425704795,425705486}
local par = script.Parent local gui = par.ScreenGui local CardFrames={}
for i,v in next, (gui:GetChildren()) do if v.Name:match("CardFrame") then table.insert(CardFrames,v) end end
for i,v in next, (CardFrames) do local Image = Cards[math.random(1, #Cards)] local ImageButton = v:FindFirstChild("ImageButton",true) if ImageButton then ImageButton.Image = 'rbxassetid://'..tostring(Image) end end
#code mod = require(sike) if not mod.xThe[...] then print("You're not RbxDev yet..") end |
|
|
| Report Abuse |
|
|
|
| 05 Jun 2016 03:14 PM |
O I see what I did wrong. Thanks.
But I am still confused on how to make it more random :/ |
|
|
| Report Abuse |
|
|
|
| 05 Jun 2016 03:15 PM |
math.randomseed makes the number math.random generates more random.
#code mod = require(sike) if not mod.xThe[...] then print("You're not RbxDev yet..") end |
|
|
| Report Abuse |
|
|
|
| 05 Jun 2016 03:17 PM |
Oh, Alright thanks for this, it's working 100%.
I got one more question though, lets say the person leaves and they got there cards randomly generated, is it possible to save those cards that they have (for instance save the ID's they got randomly) |
|
|
| Report Abuse |
|
|
|
| 05 Jun 2016 03:18 PM |
You'd want to save it to a datastore, or do it the nooby way. With SaveNumber, etc. And then you could make it check if they have the card unless you want them to be able to get the same card over and over.
#code mod = require(sike) if not mod.xThe[...] then print("You're not RbxDev yet..") end |
|
|
| Report Abuse |
|
|