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: Equation

Previous Thread :: Next Thread 
MillerGemini is not online. MillerGemini
Joined: 21 Aug 2015
Total Posts: 898
02 Jul 2016 05:35 PM
Give me an equation where the numbers will be randomized, but have to stay below 5.

For example

2
3
4
1

or

4
2
1
3
Report Abuse
SloeGin is not online. SloeGin
Joined: 22 Jan 2011
Total Posts: 322
02 Jul 2016 05:39 PM
while true do
wait()
print(math.random[1, 4])
end

Why did I bother answering this.


218,236 slices of pizza and counting
Report Abuse
LateralLace is not online. LateralLace
Joined: 19 Sep 2015
Total Posts: 662
02 Jul 2016 05:40 PM
Um.

Set = {1,2,3,4}
for i=1,#Set do
v = Set[i]
table.remove(Set,i)
table.insert(Set,v,math.random(1,#Set+1))
end
Report Abuse
MillerGemini is not online. MillerGemini
Joined: 21 Aug 2015
Total Posts: 898
02 Jul 2016 05:40 PM
local Number = 1
for i = 1,#Answers do
local Select = Exam:FindFirstChild('Talk'..Number)
Select.Text = Answers[i].Name
Number = Number + 1
end

This will set,
1
2
3
4

What can I do to randomize the selection, while keep the 4 values? Example above.
Report Abuse
SloeGin is not online. SloeGin
Joined: 22 Jan 2011
Total Posts: 322
02 Jul 2016 05:42 PM
You should take your variable names out of context when posting on this forum unless you post the entire context tbh... Or it gets confusing af to read...


218,236 slices of pizza and counting
Report Abuse
SloeGin is not online. SloeGin
Joined: 22 Jan 2011
Total Posts: 322
02 Jul 2016 05:44 PM
If you modify the technique Lateral was using and insert it into your code it should work I think.


218,236 slices of pizza and counting
Report Abuse
MillerGemini is not online. MillerGemini
Joined: 21 Aug 2015
Total Posts: 898
02 Jul 2016 05:44 PM
@Slow.

Corrected your arrogance.

while true do
wait()
print(math.random(1,4))
end
Report Abuse
LateralLace is not online. LateralLace
Joined: 19 Sep 2015
Total Posts: 662
02 Jul 2016 05:44 PM
^^^^ ye ditto
Report Abuse
LateralLace is not online. LateralLace
Joined: 19 Sep 2015
Total Posts: 662
02 Jul 2016 05:45 PM
Meant my above post to be for Sloegin lol
Report Abuse
CyberNugget is not online. CyberNugget
Joined: 04 Dec 2011
Total Posts: 568
02 Jul 2016 05:46 PM
while wait() do
print(math.random(1,4))
end

Let's make it three lines instead.


Report Abuse
SloeGin is not online. SloeGin
Joined: 22 Jan 2011
Total Posts: 322
02 Jul 2016 05:46 PM
It doesn't matter whether you use parentheses or square brackets. Square brackets make it easier to read, you just have to remember to avoid using two in sequence... I wish not to get too salty but at least learn your fruit names.


218,236 slices of pizza and counting
Report Abuse
SloeGin is not online. SloeGin
Joined: 22 Jan 2011
Total Posts: 322
02 Jul 2016 05:47 PM
gg cyber :P


218,258 slices of pizza and counting
Report Abuse
CyberNugget is not online. CyberNugget
Joined: 04 Dec 2011
Total Posts: 568
02 Jul 2016 05:47 PM
gg @Sloe.


Report Abuse
warspyking is not online. warspyking
Joined: 15 Nov 2011
Total Posts: 13947
02 Jul 2016 05:53 PM
@sloe You can't call functions with square brackets.

@Cyber while true do is more efficient.
Report Abuse
SloeGin is not online. SloeGin
Joined: 22 Jan 2011
Total Posts: 322
02 Jul 2016 05:54 PM
Not even math.random? :O You used to be able to with the standard libraries?! Thanks. RIP me.


218,258 slices of pizza and counting
Report Abuse
DurstAuric is not online. DurstAuric
Joined: 12 May 2009
Total Posts: 8066
02 Jul 2016 05:55 PM
math.randomseed(tick() * math.random())
while wait() do print(math.random(1, 4)) end


-=[ RAP: 336,411 || DurstAuric; the narb of ROBLOX ]=-
Report Abuse
MillerGemini is not online. MillerGemini
Joined: 21 Aug 2015
Total Posts: 898
02 Jul 2016 05:55 PM
"It doesn't matter whether you use parentheses or square brackets." Lol.
Report Abuse
SloeGin is not online. SloeGin
Joined: 22 Jan 2011
Total Posts: 322
02 Jul 2016 05:56 PM
It doesn't... If it's a variable :'(


218,258 slices of pizza and counting
Report Abuse
warspyking is not online. warspyking
Joined: 15 Nov 2011
Total Posts: 13947
02 Jul 2016 06:13 PM
Not even with variables or standard libraries sloe.

Square brackets are for indexing tables, not for calling functions.
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