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: Easy question:

Previous Thread :: Next Thread 
GGGGG14 is not online. GGGGG14
Joined: 29 Jan 2012
Total Posts: 25344
14 Dec 2013 08:30 PM
Can you use math.random() for boolean values…

for Example:

while wait(1) do
script.Parent.PointLight.Enabled = math.random(true, false)
end


???
Report Abuse
mrpricetoyou is not online. mrpricetoyou
Joined: 25 Nov 2011
Total Posts: 5160
14 Dec 2013 08:30 PM
No, it only accepts integers in it's parameters I believe
Report Abuse
GGGGG14 is not online. GGGGG14
Joined: 29 Jan 2012
Total Posts: 25344
14 Dec 2013 08:32 PM
what if I did something like

on = true
off = false

while wait(1) do
script.Parent.PointLight.Enabled = math.random(on, off)
end
Report Abuse
mrpricetoyou is not online. mrpricetoyou
Joined: 25 Nov 2011
Total Posts: 5160
14 Dec 2013 08:34 PM
No, the variables would be the same thing as you originally posted so there would be no different outcome
Report Abuse
GGGGG14 is not online. GGGGG14
Joined: 29 Jan 2012
Total Posts: 25344
14 Dec 2013 08:35 PM
ty for helping :P

Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
14 Dec 2013 10:14 PM
blah = math.random() <= 5
Report Abuse
Jetta765214 is not online. Jetta765214
Joined: 22 Oct 2008
Total Posts: 1855
14 Dec 2013 10:17 PM
you can do:

while wait(1) do
script.Parent.PointLight.Enabled = math.random(2)==1
end

or easier to understand:

while wait(1) do
script.Parent.PointLight.Enabled = math.random(2)==1 and true or false
end

it is redundant though

Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
14 Dec 2013 10:19 PM
<= 0.5*
Report Abuse
mrpricetoyou is not online. mrpricetoyou
Joined: 25 Nov 2011
Total Posts: 5160
15 Dec 2013 11:44 AM
cntkillme is right
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