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: Sorry, but I'm horrible w/ math.random [help plx]

Previous Thread :: Next Thread 
Leveraged is not online. Leveraged
Joined: 23 Jul 2010
Total Posts: 11564
24 Aug 2015 10:10 PM
so like

im making a script, that randomly makes certain imagelabels go visible/invisible, and a sound turn on/off with that.

I'm too impatient to wait for this to execute, but would this work?

i = math.random(100,10,30,50,250,300,2)
f = math.random(200,250,150,100,50,25)
e = math.random(.3,.5,.15,.25)
while wait() do
local g = script.Parent.BlizzardGui
g.Flakes.Visible = false
g.Flakes2.Visible = false
g.Wind.Volume = e
wait(i)
g.Flakes.Visible = true
g.Wind.Volume = 1
g.Flakes2.Visible = true
wait(f)
end

I suppose I could use smaller values, but ye




aright aright aright -lord matthew 2015
Report Abuse
gangman67 is not online. gangman67
Joined: 04 Jun 2011
Total Posts: 798
24 Aug 2015 10:11 PM
math.random(2, 300)
only use to values it will pick a num 2 - 300
Report Abuse
Leveraged is not online. Leveraged
Joined: 23 Jul 2010
Total Posts: 11564
24 Aug 2015 10:12 PM
ya idk how it works


aright aright aright -lord matthew 2015
Report Abuse
Leveraged is not online. Leveraged
Joined: 23 Jul 2010
Total Posts: 11564
24 Aug 2015 10:12 PM
ohhh, ty lmao


aright aright aright -lord matthew 2015
Report Abuse
KoreanBBQ is not online. KoreanBBQ
Joined: 06 Mar 2015
Total Posts: 1436
24 Aug 2015 10:18 PM
the math.random takes two arguments: minimum value, and max value, and it then picks a random integer in those boundaries following a seed pattern which can be defined as well


~TreeBranch, Owner of Lady of the Federation x2+ Crown of Roses
Report Abuse
Leveraged is not online. Leveraged
Joined: 23 Jul 2010
Total Posts: 11564
24 Aug 2015 10:19 PM
This works, but it waits the max amount of time every single time [20].

i = math.random(1,20)
f = math.random(1,20)
e = math.random(.15,.75)
while wait() do
local g = script.Parent.BlizzardGui
g.Flakes.Visible = false
g.Flakes2.Visible = false
g.Frost.Visible = false
g.LocalScript.Disabled = true
g.LocalScript1.Disabled = true
script.Parent.Wind.Sound.Volume = e
wait(i)
g.LocalScript.Disabled = false
g.LocalScript1.Disabled = false
g.Flakes.Visible = true
g.Frost.Visible = true
script.Parent.Wind.Sound.Volume = 1
g.Flakes2.Visible = true
wait(f)
end


Any help?


aright aright aright -lord matthew 2015
Report Abuse
Ooko is not online. Ooko
Joined: 09 Jun 2008
Total Posts: 11480
24 Aug 2015 10:27 PM
while true do
i = math.random(1,20)
f = math.random(1,20)
e = math.random(.15,.75)
while wait() do
local g = script.Parent.BlizzardGui
g.Flakes.Visible = false
g.Flakes2.Visible = false
g.Frost.Visible = false
g.LocalScript.Disabled = true
g.LocalScript1.Disabled = true
script.Parent.Wind.Sound.Volume = e
wait(i)
g.LocalScript.Disabled = false
g.LocalScript1.Disabled = false
g.Flakes.Visible = true
g.Frost.Visible = true
script.Parent.Wind.Sound.Volume = 1
g.Flakes2.Visible = true
wait(f)
end
Report Abuse
Ooko is not online. Ooko
Joined: 09 Jun 2008
Total Posts: 11480
24 Aug 2015 10:29 PM
The script it only firing once, so each variable is only set once, thus every time the wait(i) command hits, it waits the same amount of time. putting the while true do loop before the variable setting lets the variables be assigned over and over (thought I don't know if you want this to be an endles sound thingy)
Report Abuse
Ripepperoni is not online. Ripepperoni
Joined: 04 Jul 2010
Total Posts: 5715
25 Aug 2015 12:03 AM
while true do
i = math.random(100,10,30,50,250,300,2)
f = math.random(200,250,150,100,50,25)
e = math.random(.3,.5,.15,.25)
local g = script.Parent.BlizzardGui
g.Flakes.Visible = false
g.Flakes2.Visible = false
g.Wind.Volume = e
wait(i)
g.Flakes.Visible = true
g.Wind.Volume = 1
g.Flakes2.Visible = true
wait(f)
end

****
Report Abuse
sharpchain1 is not online. sharpchain1
Joined: 05 Aug 2013
Total Posts: 1009
25 Aug 2015 01:41 AM
Lol math.random() only has 2 parameters

math.random(lowest number, highest number)

You like Clash of Clans? Play this developing masterpiece by Domini Studios
http://www.roblox.com/games/282763164/Clash-of-Bloxians-Beta Scripted by yours truly
Report Abuse
LimitedSword is not online. LimitedSword
Joined: 19 Nov 2011
Total Posts: 487
25 Aug 2015 02:49 AM
[ Content Deleted ]
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