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: Need help with this math random

Previous Thread :: Next Thread 
rockandgreen is not online. rockandgreen
Joined: 20 Dec 2011
Total Posts: 1161
22 Dec 2013 08:14 AM
tele = teles[math.random(1,#teles)]
x1 = tele.Position.X-(tele.Size.X/2)
x2 = tele.Position.X+(tele.Size.X/2)
z1 = tele.Position.Z-(tele.Size.Z/2)
z2 = tele.Position.Z+(tele.Size.Z/2)
obj.Character.Torso.CFrame = CFrame.new(math.random(x1,x2),tele.Position.Y+5,math.random(z1,z2))
==================================================================================
On the first line it has tele = teles[math.random(1,#teles)] but the argument of the math.random head no interval (1,#teles) < what do I do to put an interval?
----------------------------------------------------------------------------------
Thanks and no harsh comments please,
Rockandgreen
Report Abuse
vlekje513 is not online. vlekje513
Joined: 28 Dec 2010
Total Posts: 9057
22 Dec 2013 08:19 AM
You don't got a table called "teles"
Report Abuse
rockandgreen is not online. rockandgreen
Joined: 20 Dec 2011
Total Posts: 1161
22 Dec 2013 08:27 AM
vle I dont get what you mean and by the way this is pat of a much bigger script.
Report Abuse
vlekje513 is not online. vlekje513
Joined: 28 Dec 2010
Total Posts: 9057
22 Dec 2013 08:28 AM
Post the full script then.
Report Abuse
rockandgreen is not online. rockandgreen
Joined: 20 Dec 2011
Total Posts: 1161
22 Dec 2013 08:29 AM
On the output window on my game when we play the rounds it hits this coding and stops because it say in the output window that there needs to be an interval...
Report Abuse
rockandgreen is not online. rockandgreen
Joined: 20 Dec 2011
Total Posts: 1161
22 Dec 2013 08:30 AM
Erm if I do it is lke 500 lines long so....... yeah
Report Abuse
vlekje513 is not online. vlekje513
Joined: 28 Dec 2010
Total Posts: 9057
22 Dec 2013 08:32 AM
........ I cant help then, sorry.
Report Abuse
rockandgreen is not online. rockandgreen
Joined: 20 Dec 2011
Total Posts: 1161
22 Dec 2013 08:34 AM
vle the problem is that the output window is asking that i need to put and interval in the argument which is (1,#teles) which is need to know how to put and interval there....
Report Abuse
rockandgreen is not online. rockandgreen
Joined: 20 Dec 2011
Total Posts: 1161
22 Dec 2013 08:43 AM
Can anyone help? .-.
Report Abuse
CrniOrao is not online. CrniOrao
Joined: 12 Oct 2008
Total Posts: 2274
22 Dec 2013 08:46 AM
Isn't it supposed to be just this?

tele = math.random(1, #teles)
Report Abuse
rockandgreen is not online. rockandgreen
Joined: 20 Dec 2011
Total Posts: 1161
22 Dec 2013 08:49 AM
teles = {}
for nuum, obbj in pairs(cc) do
if team == 1 then
if obbj.Name == "RedTele" then
table.insert (teles, obbj)
end
elseif team == 2 then
if obbj.Name == "BlueTele" then
table.insert (teles, obbj)
end
end
wait()
end
==================================================================================
I guess this is the table part
Report Abuse
rockandgreen is not online. rockandgreen
Joined: 20 Dec 2011
Total Posts: 1161
22 Dec 2013 08:53 AM
Crni I tried dat but it just says the same that it need na interval.....
Report Abuse
rockandgreen is not online. rockandgreen
Joined: 20 Dec 2011
Total Posts: 1161
22 Dec 2013 09:02 AM
any help?
Report Abuse
Duelingwarlord is not online. Duelingwarlord
Joined: 15 Feb 2010
Total Posts: 22333
22 Dec 2013 09:16 AM
shouldn't it be a table with the locations
and math.random of the table?
Report Abuse
rockandgreen is not online. rockandgreen
Joined: 20 Dec 2011
Total Posts: 1161
22 Dec 2013 11:15 AM
Duel it is not the table which is the problem it is that i need an interval in the(1,#teles) part and can anybody at all help me?
Report Abuse
rockandgreen is not online. rockandgreen
Joined: 20 Dec 2011
Total Posts: 1161
22 Dec 2013 11:22 AM
Anyone?
Report Abuse
rockandgreen is not online. rockandgreen
Joined: 20 Dec 2011
Total Posts: 1161
22 Dec 2013 12:19 PM
Can anybody else help... I am really stuck? If you dont know any suggestions on how to get the interval in (1,#teles)....
Report Abuse
wazap is not online. wazap
Joined: 29 Jun 2007
Total Posts: 23234
22 Dec 2013 12:23 PM
Are you sure its referring to that math.random and not, say the math.random(x1, x2) or math.random(z1, z2) ?
Because in that case, z1, z2, x1, x2 can be decimals, which can cause problems for the math.random...
Report Abuse
rockandgreen is not online. rockandgreen
Joined: 20 Dec 2011
Total Posts: 1161
22 Dec 2013 03:41 PM
I have no idea what your saying but it definatly says on that line and it says tele = teles[math.random(1,#teles)] -- this is a bad argument (no interval)....
Report Abuse
rockandgreen is not online. rockandgreen
Joined: 20 Dec 2011
Total Posts: 1161
22 Dec 2013 03:45 PM
Any help?
Report Abuse
rockandgreen is not online. rockandgreen
Joined: 20 Dec 2011
Total Posts: 1161
22 Dec 2013 04:07 PM
All I need to know is how do I add the interval in the (1,#teles)
Report Abuse
wazap is not online. wazap
Joined: 29 Jun 2007
Total Posts: 23234
22 Dec 2013 05:40 PM
Its possible that teles is an empty table at this point.
Report Abuse
rockandgreen is not online. rockandgreen
Joined: 20 Dec 2011
Total Posts: 1161
23 Dec 2013 01:48 AM
No I am pretty sure that the problem is and interval at the (1,#teles) part the table works fine... this aint my script but when I ran it before it had no problems it probably just the interval.... Still waiting for ideas or suggestions on what I should do
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
23 Dec 2013 01:49 AM
It means #teles < 1
Report Abuse
rockandgreen is not online. rockandgreen
Joined: 20 Dec 2011
Total Posts: 1161
23 Dec 2013 01:54 AM
Oh so if I put that then the output should have no problems...?
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