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 » Scripters
Home Search
 

Re: YO HOW DO I

Previous Thread :: Next Thread 
ImRadiant is not online. 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 is not online. 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 is not online. ImRadiant
Joined: 05 Sep 2016
Total Posts: 541
08 Sep 2016 01:09 PM
Nothing about the asked question there.
Report Abuse
TimeTicks is not online. 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
KillerKyle is not online. KillerKyle
Joined: 29 Jul 2007
Total Posts: 6371
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 is not online. 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
Flux_Capacitor is not online. Flux_Capacitor
Joined: 07 Apr 2008
Total Posts: 45720
08 Sep 2016 01:47 PM
why not
Report Abuse
ImRadiant is not online. 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
Flux_Capacitor is not online. Flux_Capacitor
Joined: 07 Apr 2008
Total Posts: 45720
08 Sep 2016 01:51 PM
rangui.Visible = true

Also make sure you connect some event to it
Report Abuse
ImRadiant is not online. ImRadiant
Joined: 05 Sep 2016
Total Posts: 541
08 Sep 2016 01:52 PM
Event? Sorry I'm kind of new.
Report Abuse
Flux_Capacitor is not online. Flux_Capacitor
Joined: 07 Apr 2008
Total Posts: 45720
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 is not online. 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 is not online. 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
Flux_Capacitor is not online. Flux_Capacitor
Joined: 07 Apr 2008
Total Posts: 45720
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 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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