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
 

Re: Help me start this?

Previous Thread :: Next Thread 
madness725 is not online. madness725
Joined: 19 Apr 2011
Total Posts: 2058
01 Sep 2013 12:39 AM
A gui that pops up on everyone's screen, 3 options Easy, Medium, and Hard. After a certain amount of time it collects the votes and does a function in a script? But not a script inside the gui
Report Abuse
madness725 is not online. madness725
Joined: 19 Apr 2011
Total Posts: 2058
01 Sep 2013 12:42 AM
I could right the script, I just need like a basic understanding on what I need to do. Like make a script in the gui to collect the votes and I dont know da rest
Report Abuse
ninetailfox73 is not online. ninetailfox73
Joined: 11 Mar 2008
Total Posts: 1954
01 Sep 2013 12:53 AM
If you don't know how to do it, then you don't know how to write the script. I can't explain it unless a write a bunch of stuf, but I'm too lazy for that so. Just break it down, and go to the wiki for each part. Once you do all that tell me how you're going to script it then I'll correct you.
Report Abuse
DragonODeath is not online. DragonODeath
Joined: 02 May 2011
Total Posts: 1252
01 Sep 2013 12:55 AM
PlayerGui
TextButtons
LocalScript
MAYBE IntValue to represent difficulties: 1 being Easy, 2 being Medium and so on.
Report Abuse
madness725 is not online. madness725
Joined: 19 Apr 2011
Total Posts: 2058
01 Sep 2013 12:57 AM
Well, Lets say I have

EasyVoteValue = 4
MedVoteValue = 3
HardVoteValue = 7

How would I find the Highest one?
Report Abuse
lampwnage121 is not online. lampwnage121
Joined: 20 Oct 2012
Total Posts: 4285
01 Sep 2013 01:00 AM
print(math.max(EasyVoteValue, MediumVoteValue, HardVoteValue))

Never used this before though
Report Abuse
ninetailfox73 is not online. ninetailfox73
Joined: 11 Mar 2008
Total Posts: 1954
01 Sep 2013 01:00 AM
Now we're making progress!

EasyVoteValue = 4
MedVoteValue = 3
HardVoteValue = 7

if EasyVoteValue > MedVoteValue and EasyVoteValue > HardVoteValue then
--stuff
elseif MedVoteValue > EasyVoteValue and MedVoteValue > HardVoteValue then
--stuff
elseif MedVoteValue > HardVoteValue and EasyVoteValue > MedVoteValue then
--stuff
end

Report Abuse
ninetailfox73 is not online. ninetailfox73
Joined: 11 Mar 2008
Total Posts: 1954
01 Sep 2013 01:01 AM
Wow I've never even heard of math.max -.- I feel stupid.
Report Abuse
your90 is not online. your90
Joined: 06 Mar 2011
Total Posts: 1380
01 Sep 2013 01:02 AM
Looool this is so advanced for me. ;o
Report Abuse
lampwnage121 is not online. lampwnage121
Joined: 20 Oct 2012
Total Posts: 4285
01 Sep 2013 01:02 AM
Lel, I quickly checked wiki because I remembered seeing this.

http://wiki.roblox.com/index.php/Function_Dump/Mathematical_Functions#math.max

Also, The way you did it would take alot of work for some games with alot of vote buttons
Report Abuse
Iterations is not online. Iterations
Joined: 22 Jul 2013
Total Posts: 751
01 Sep 2013 01:03 AM
function GetHighest(Table)
local x,amount,tied,z=0,0,{}
for i,v in pairs(Table)do
if v>amount then
amount,z=v,i
tied={v}
elseif v==amount then
table.insert(tied,v)
end
end
local y = math.random(#tied)
return z, tied[y]
end

local Table = {EasyVoteValue = 4, MedVoteValue = 3, HardVoteValue = 7}

print(GetHighest(Table))

>HardVoteValue 7
Report Abuse
ninetailfox73 is not online. ninetailfox73
Joined: 11 Mar 2008
Total Posts: 1954
01 Sep 2013 01:04 AM
LOL
math.max conquers all.
I wish I knew about this earlier. Such a simple line, yet so powerful.
Report Abuse
lampwnage121 is not online. lampwnage121
Joined: 20 Oct 2012
Total Posts: 4285
01 Sep 2013 01:05 AM
> print(math.max(4, 20, 34, 17))
34
Simple lel
Report Abuse
Iterations is not online. Iterations
Joined: 22 Jul 2013
Total Posts: 751
01 Sep 2013 01:05 AM
math.max is not helpful in this case. It will just return the highest number, but not actually give you which one won.
Report Abuse
ninetailfox73 is not online. ninetailfox73
Joined: 11 Mar 2008
Total Posts: 1954
01 Sep 2013 01:06 AM
^^?
Make it a variable instead of printing it.

highestvote = math.max(EasyVoteValue, MediumVoteValue, HardVoteValue)
Report Abuse
Iterations is not online. Iterations
Joined: 22 Jul 2013
Total Posts: 751
01 Sep 2013 01:07 AM
If you did that it would just give you a number, not actually any of "EasyVoteValue, MediumVoteValue, HardVoteValue".
Report Abuse
your90 is not online. your90
Joined: 06 Mar 2011
Total Posts: 1380
01 Sep 2013 01:08 AM
^^^ is a genius.
Report Abuse
ninetailfox73 is not online. ninetailfox73
Joined: 11 Mar 2008
Total Posts: 1954
01 Sep 2013 01:09 AM
...All we need is the number?
Report Abuse
Iterations is not online. Iterations
Joined: 22 Jul 2013
Total Posts: 751
01 Sep 2013 01:10 AM
...

local X, Y, Z = 1, 2, 3

local Highest = math.max(X, Y, Z)

>3

We don't actually know if it's X, Y, or Z from the math.max function. Which means if we're trying to determine if it's Easy, Medium, or Hard that won, this function renders useless.
Report Abuse
lampwnage121 is not online. lampwnage121
Joined: 20 Oct 2012
Total Posts: 4285
01 Sep 2013 01:12 AM
Actually, You could loop through the Stored values and find the one with the same value that math.max printed. I am making it simple for him since he is just starting out.
Report Abuse
madness725 is not online. madness725
Joined: 19 Apr 2011
Total Posts: 2058
01 Sep 2013 01:14 AM
So was this script ok at all?\


if EasyVoteValue > MedVoteValue and EasyVoteValue > HardVoteValue then
--stuff
elseif MedVoteValue > EasyVoteValue and MedVoteValue > HardVoteValue then
--stuff
elseif MedVoteValue > HardVoteValue and EasyVoteValue > MedVoteValue then
--stuff
end
Report Abuse
lampwnage121 is not online. lampwnage121
Joined: 20 Oct 2012
Total Posts: 4285
01 Sep 2013 01:16 AM
Not this part
elseif MedVoteValue > HardVoteValue and EasyVoteValue > MedVoteValue then
Report Abuse
madness725 is not online. madness725
Joined: 19 Apr 2011
Total Posts: 2058
01 Sep 2013 01:25 AM
Why?
Report Abuse
ninetailfox73 is not online. ninetailfox73
Joined: 11 Mar 2008
Total Posts: 1954
01 Sep 2013 01:25 AM
THEN I SHALL MAKE A LOOP WITH MATH.MAX
Report Abuse
lampwnage121 is not online. lampwnage121
Joined: 20 Oct 2012
Total Posts: 4285
01 Sep 2013 01:27 AM
Its checking if the Medium vote is higher then the Hard vote but smaller then the Easy vote rather that being larger then both.
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