ImRadiant
|
  |
| Joined: 05 Sep 2016 |
| Total Posts: 541 |
|
|
| 08 Sep 2016 12:59 PM |
| MAKE A SCRIPT THAT PICKS A RANDOM GUI FROM A GROUP OF THEM? |
|
|
| Report Abuse |
|
|
vexieh
|
  |
| Joined: 22 Oct 2009 |
| Total Posts: 3468 |
|
|
| 08 Sep 2016 01:06 PM |
http://wiki.roblox.com/index.php?title=Intro_to_Scripting
|
|
|
| Report Abuse |
|
|
ImRadiant
|
  |
| Joined: 05 Sep 2016 |
| Total Posts: 541 |
|
|
| 08 Sep 2016 01:09 PM |
| Nothing about the asked question there. |
|
|
| Report Abuse |
|
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
|
| 08 Sep 2016 01:22 PM |
local guis = frame:GetChildren()
local rangui = guis[math.random(1,#guis)]
print(rangui.Name)
|
|
|
| Report Abuse |
|
|
|
| 08 Sep 2016 01:29 PM |
This is scripters HELPERS, not scripters REQUEST.
Attempt it on your own and we will help you get it working along the way. |
|
|
| Report Abuse |
|
|
ImRadiant
|
  |
| Joined: 05 Sep 2016 |
| Total Posts: 541 |
|
|
| 08 Sep 2016 01:37 PM |
| TimeTicks would I be able to add a on click to that? I'll test it and try to make it select a random gui and make it visible on click :P |
|
|
| Report Abuse |
|
|
| |
|
ImRadiant
|
  |
| Joined: 05 Sep 2016 |
| Total Posts: 541 |
|
|
| 08 Sep 2016 01:50 PM |
Ugh I'm horrible at scripting. I ask of anyone to tell me what I've done wrong (probably everything):
function onClick() local guis = script.Parent.Parent:GetChildren()
local rangui = guis[math.random(1,#guis)]
wait(0.1) script.Parent.Parent.guis.Visible = true end
Text button and 3 frames inside of parent frame inside of screengui. |
|
|
| Report Abuse |
|
|
|
| 08 Sep 2016 01:51 PM |
rangui.Visible = true
Also make sure you connect some event to it |
|
|
| Report Abuse |
|
|
ImRadiant
|
  |
| Joined: 05 Sep 2016 |
| Total Posts: 541 |
|
|
| 08 Sep 2016 01:52 PM |
| Event? Sorry I'm kind of new. |
|
|
| Report Abuse |
|
|
|
| 08 Sep 2016 01:53 PM |
button.MouseButton1Down:connect(onClick)
You have to tell roblox to call your onClick function when they click the text button |
|
|
| Report Abuse |
|
|
ImRadiant
|
  |
| Joined: 05 Sep 2016 |
| Total Posts: 541 |
|
|
| 08 Sep 2016 01:59 PM |
WOO! Got it (kind of) working
local guis = script.Parent.Parent.Frame:GetChildren()
local rangui = guis[math.random(1,#guis)]
function onClick() rangui.BackgroundTransparency = 0 end
script.Parent.MouseButton1Down:connect(onClick)
can a simple loop fix this? |
|
|
| Report Abuse |
|
|
ImRadiant
|
  |
| Joined: 05 Sep 2016 |
| Total Posts: 541 |
|
|
| 08 Sep 2016 02:01 PM |
| Any way of making sure it always picks a random one? It seems to always pick the same one. |
|
|
| Report Abuse |
|
|
|
| 08 Sep 2016 02:03 PM |
| It always picks the same one because you put "local rangui = guis[math.random(1,#guis)]" outside of your onClick function, you're only ever getting a random one once. Put that line inside the function then it should work. |
|
|
| Report Abuse |
|
|
ImRadiant
|
  |
| Joined: 05 Sep 2016 |
| Total Posts: 541 |
|
|
| 08 Sep 2016 02:04 PM |
| YAY! I know I've asked for a lot, but how would I go about making more than one gui pop up at once. |
|
|
| Report Abuse |
|
|
superICH3
|
  |
| Joined: 25 May 2010 |
| Total Posts: 4729 |
|
|
| 08 Sep 2016 02:05 PM |
Read all the basic tutorials on the ROBLOX WIKI then come back.
Rap: 3,661 |
|
|
| Report Abuse |
|
|
ImRadiant
|
  |
| Joined: 05 Sep 2016 |
| Total Posts: 541 |
|
|
| 08 Sep 2016 02:05 PM |
:P done it just added local rangui = guis[math.random(#guis)] again... |
|
|
| Report Abuse |
|
|
ImRadiant
|
  |
| Joined: 05 Sep 2016 |
| Total Posts: 541 |
|
|
| 08 Sep 2016 02:31 PM |
local guis = script.Parent.Parent.Frame:GetChildren()
function onClick() if script.Parent.Parent.Frame.Frame.BackgroundTransparency == 1 then script.Parent.Parent.Frame.Frame.BackgroundTransparency = 0 end if script.Parent.Parent.Frame.Frame2.BackgroundTransparency == 1 then script.Parent.Parent.Frame.Frame2.BackgroundTransparency = 0
script.Parent.Parent.Frame.Frame3.BackgroundTransparency = 1 end
if script.Parent.Parent.Frame.Frame3.BackgroundTransparency == 1 then script.Parent.Parent.Frame.Frame3.BackgroundTransparency = 0 end wait(5)
if script.Parent.Parent.Frame.Frame.BackgroundTransparency == 0 then script.Parent.Parent.Frame.Frame.BackgroundTransparency = 1
end if script.Parent.Parent.Frame.Frame2.BackgroundTransparency == 0 then script.Parent.Parent.Frame.Frame2.BackgroundTransparency = 1 end if script.Parent.Parent.Frame.Frame3.BackgroundTransparency == 0 then script.Parent.Parent.Frame.Frame3.BackgroundTransparency = 1 end end
script.Parent.MouseButton1Down:connect(onClick)
+1 scripting |
|
|
| Report Abuse |
|
|
ImRadiant
|
  |
| Joined: 05 Sep 2016 |
| Total Posts: 541 |
|
|
| 08 Sep 2016 02:35 PM |
Now I gotta make it cost [Value] every click.
I imagine
if game.Workspace.[Insert generic leaderboard script here].[Value, let's just say ko] =< [Let's say it costs 100 kos] then script.Disabled = true wait(1) script.Disabled = false and run a loop of that? |
|
|
| Report Abuse |
|
|