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
 

Easy Line...

Previous Thread :: Next Thread 
Miro034 is not online. Miro034
Joined: 07 Oct 2009
Total Posts: 6568
01 Sep 2011 09:03 AM
I been trying to figure out how to use math.random using this line i think its in correct. can you help?


function Click()

for i=1,10 do

game.Lighting.(math.random(Brick1).math.random(Brick2)).Position = game.Workspace.(math.random(Brick1).math.random(Brick2)).ck1.Position + Vector3.new(1,1,1)
wait(3)
end
i= -6

script.Parent.MouseButton1Down:connect(Click)

The script is in a Textbutton. Can you fix it?
Report Abuse
Miro034 is not online. Miro034
Joined: 07 Oct 2009
Total Posts: 6568
01 Sep 2011 09:04 AM
Oh I forgot, The script is trying to choose which one will go to (1,1,1). Its uses math.random to choose either Brick1 or Brick2 to move to Vector3.new(1,1,1)
Report Abuse
zars15 is not online. zars15
Joined: 10 Nov 2008
Total Posts: 9999
01 Sep 2011 09:05 AM
Kind of messed up.. If you want random part there is sume ussefull stuff:

c = game.Workspace:GetChildren()

randomPart = c[math.random(1,c)]
Report Abuse
Miro034 is not online. Miro034
Joined: 07 Oct 2009
Total Posts: 6568
01 Sep 2011 09:05 AM
Oh I forgot, The script is trying to choose which one will go to (1,1,1). Its uses math.random to choose either Brick1 or Brick2 to move to Vector3.new(1,1,1)

I hate flood check! 5x OMG
Report Abuse
zars15 is not online. zars15
Joined: 10 Nov 2008
Total Posts: 9999
01 Sep 2011 09:08 AM
You did it wrong. The math random works only with numbers. Do example what i did. You can do it with any table soo you can do this too:

table = {part1,part2}
randomPart = table[math.random(1,#table)]
Report Abuse
Miro034 is not online. Miro034
Joined: 07 Oct 2009
Total Posts: 6568
01 Sep 2011 09:12 AM
Ok, so when I use your table,

table = {part1,part2}
RandomPart = table[math.random(1,#table)]

game.Lighting.RandomPart.Position = game.Lighting.Brick1.Position + Vector3.new(1,1,1)

Is this right?
Report Abuse
zars15 is not online. zars15
Joined: 10 Nov 2008
Total Posts: 9999
01 Sep 2011 09:15 AM
depens how you do it. Two ways how:

table = {game.Lighting.Part1,game.Lighting.Part2}
r = table[math.random(1,#table)]
r.Position.............


Or other way:

table = {"Part1","Part2"}
r = table[math.random(1,#table)]
game.Lighting[r].Position.............
Report Abuse
Miro034 is not online. Miro034
Joined: 07 Oct 2009
Total Posts: 6568
01 Sep 2011 09:23 AM
table = {game.Lighting.Part1,game.Lighting.Part2}
miro = table[math.random(1,#table)]

function Click()

for i=1, 10 do
game.Lighting.miro.Position = game.miro.Position + Vector3.new(1,1,1)
wait(3)
end
i = -6
end

script.Parent.MouseButton1Down:connect(Click)

there. Does it work now?
Report Abuse
Miro034 is not online. Miro034
Joined: 07 Oct 2009
Total Posts: 6568
01 Sep 2011 09:31 AM
BUMP
Report Abuse
Prehistoricman is not online. Prehistoricman
Joined: 20 Sep 2008
Total Posts: 12490
01 Sep 2011 09:57 AM
miro is not a valid member of Lighting.

Your variable is already in Lighting. If your syntax was correct, you would be doing game.Lighting.game.Lighting.Part1.

table = {game.Lighting.Part1,game.Lighting.Part2}
miro = table[math.random(1,#table)]

function Click()

for i=1, 10 do
miro.Position = miro.Position + Vector3.new(1,1,1)
wait(3)
end
end

script.Parent.MouseButton1Down:connect(Click)
Report Abuse
Miro034 is not online. Miro034
Joined: 07 Oct 2009
Total Posts: 6568
01 Sep 2011 10:57 AM
table = {game.Lighting.Part1,game.Lighting.Part2}
miro = table[math.random(1,#table)]

function Click()

for i=1, 10 do
miro.Position = miro.Position + Vector3.new(1,1,1)
wait(3)
end
i= -6
end

script.Parent.MouseButton1Down:connect(Click)

I just wanted more to be inserted when every loop finish
Report Abuse
Prehistoricman is not online. Prehistoricman
Joined: 20 Sep 2008
Total Posts: 12490
01 Sep 2011 10:59 AM
LOL!
LOL!
LOL!

That won't help you, bud. LOL!
Report Abuse
Miro034 is not online. Miro034
Joined: 07 Oct 2009
Total Posts: 6568
01 Sep 2011 11:04 AM
But I want unlimited..D: well im making an unlimited wave GUI but do you think i should make 2000x like this?
Report Abuse
Prehistoricman is not online. Prehistoricman
Joined: 20 Sep 2008
Total Posts: 12490
01 Sep 2011 11:19 AM
repeat

ST00F

until false

That is an infinite loop. OR, you can do this

while true do

ST00F

end

Make sure you have a wait there. It will crash your game otherwise.
Report Abuse
Miro034 is not online. Miro034
Joined: 07 Oct 2009
Total Posts: 6568
01 Sep 2011 12:20 PM
Well i cant use some of them in a MouseButton1Down event right?
Which one?
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