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: math.Random Not Working?

Previous Thread :: Next Thread 
HardCoreRecon is not online. HardCoreRecon
Joined: 23 Aug 2010
Total Posts: 3379
26 Sep 2014 09:02 PM
Recently, I scripted a working RaidCode for a war-clan. (For those that understand C&G terminology)

Well, for some reason, ROBLOX doesn't seem to understand what "random" means, and the same number continues to pop-up, even in different servers for math.random sequence. Here's how I have it set up.

RaidCode = math.random(1,100)
if TimeHeld.Value == ## and OwningTeam.Value == BrickColor.new("Medium stone grey") then
Instance.new("Message", game.Workspace).Text = "The raiders have won. Good game! Raid Code: "..RaidCode

The best example is right now, I changed it to 1,100 and no matter what, it comes up with 36.

Any ideas as to why?

Trouble w/ Exploiters At Your Base? Having Issues With Your LinkedSword? Use This Sword & Script Provided by The Sword Clan Community: http://www.roblox.com/---item?id=179203012 - Cubyfan2 & Cubyfan22 | Add 23,481 Posts
Report Abuse
AntiFiter is not online. AntiFiter
Joined: 14 May 2009
Total Posts: 12290
26 Sep 2014 09:10 PM
I'm pretty sure you have to add 2 dots after Cuby.

local RaidCode = math.random(1, 100)
if TimeHeld.Value == 600 and OwningTeam.Value == BrickColor.new("Medium stone grey") then
Instance.new("Message", game.Workspace).Text = "The raiders have won. Good game! Raid Code: " .. RaidCode ..
Report Abuse
HardCoreRecon is not online. HardCoreRecon
Joined: 23 Aug 2010
Total Posts: 3379
26 Sep 2014 09:11 PM
I'll give that a go.

Trouble w/ Exploiters At Your Base? Having Issues With Your LinkedSword? Use This Sword & Script Provided by The Sword Clan Community: http://www.roblox.com/---item?id=179203012 - Cubyfan2 & Cubyfan22 | Add 23,481 Posts
Report Abuse
AntiFiter is not online. AntiFiter
Joined: 14 May 2009
Total Posts: 12290
26 Sep 2014 09:12 PM
Disregard my current post

I think the problem may be

BrickColor.new("Medium stone grey")

I think it's just

"Medium stone grey"
Report Abuse
HardCoreRecon is not online. HardCoreRecon
Joined: 23 Aug 2010
Total Posts: 3379
26 Sep 2014 09:13 PM
Didn't work, it just broke the ending message all together.

Trouble w/ Exploiters At Your Base? Having Issues With Your LinkedSword? Use This Sword & Script Provided by The Sword Clan Community: http://www.roblox.com/---item?id=179203012 - Cubyfan2 & Cubyfan22 | Add 23,481 Posts
Report Abuse
HardCoreRecon is not online. HardCoreRecon
Joined: 23 Aug 2010
Total Posts: 3379
26 Sep 2014 09:15 PM
That whole part is working, the problem is the math.random function doesn't want to randomize the number.

Trouble w/ Exploiters At Your Base? Having Issues With Your LinkedSword? Use This Sword & Script Provided by The Sword Clan Community: http://www.roblox.com/---item?id=179203012 - Cubyfan2 & Cubyfan22 | Add 23,481 Posts
Report Abuse
AntiFiter is not online. AntiFiter
Joined: 14 May 2009
Total Posts: 12290
26 Sep 2014 09:16 PM
Well, I have no idea.

You could always try to write out the actual variable.
Report Abuse
CrowClaws is not online. CrowClaws
Joined: 04 Jul 2010
Total Posts: 4466
26 Sep 2014 10:33 PM
Yeah the math.random isn't random like anything.
Technically nothing is random (watch Vsauce on it)

BUT

What you could do is make a code that doesn't allow two numbers to be chosen in a row something like:

repeat wait()
RaidCode = math.random(1,100)
until RaidCode =~ LastRaidCode

Or whatever.
So it is less random but seemingly more random?
You can also set the randomseed differently but that seems not to work.
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