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
 

Ok lets get things straight!

Previous Thread :: Next Thread 
miz656 is not online. miz656
Joined: 19 Jul 2010
Total Posts: 15336
10 Jan 2012 03:54 PM
What does this do!?! I get confused :P

number = math.random(1,#_G.myTable)
game.Players[_G.myTable[number]].Character.Torso.CFrame = CFrame.new(-81.5, 1, 92)
table.insert(_G.myTable2,_G.myTable[number])
table.remove(_G.myTable,number)
wait()
game.Players[_G.myTable[number]].Character.Torso.CFrame = CFrame.new(-32.5, 1, 92)
table.insert(_G.myTable2,_G.myTable[number])
table.remove(_G.myTable,number)

What I want it to do is gets random person from table, teleports them, same person gets inserted and removed from another table. Then it happens again. Now, does this do what I want or does it Do CFrame, different person inserted, different person removed?
Report Abuse
nate890 is not online. nate890
Joined: 22 Nov 2008
Total Posts: 21686
10 Jan 2012 03:59 PM
Alright, I'll do this for you because you've been trying to do this for something like 3 days and I'm getting annoyed seeing the same thread constantly

local t1={"nate890","miz656"}
local t2={}
local pos={
CFrame.new(-81.5, 1, 92);
CFrame.new(-32.5, 1, 92)
}

for i=1,2 do
local num=math.random(1,#t1)
game.Players[t1[num]].Character.Torso.CFrame=pos[i]
table.insert(t2,t1[num])
table.remove(t1,num)
end


­<'+1 Post. Ujelly?'>
Report Abuse
miz656 is not online. miz656
Joined: 19 Jul 2010
Total Posts: 15336
10 Jan 2012 04:00 PM
@nate

I don't want that because it would only work for us two!

And how did this thread get so popular :P
Report Abuse
nate890 is not online. nate890
Joined: 22 Nov 2008
Total Posts: 21686
10 Jan 2012 04:02 PM
local t1={}
for i,p in pairs(game.Players:GetPlayers()) do
table.insert(t1,p.Name)
end
local t2=t1

local pos={
CFrame.new(-81.5, 1, 92);
CFrame.new(-32.5, 1, 92)
}

for i=1,2 do
local num=math.random(1,#t1)
game.Players[t1[num]].Character.Torso.CFrame=pos[i]
table.insert(t2,t1[num])
table.remove(t1,num)
end

­<'+1 Post. Ujelly?'>
Report Abuse
kingkiller1000 is not online. kingkiller1000
Joined: 12 Dec 2008
Total Posts: 26415
10 Jan 2012 04:03 PM
Have you ever thought you're not getting answers because nobody knows what you're trying to do, or that your script is unclear (i.e. variables could possibly be too vague names so we have no clue what they're supposed to represent?)
Report Abuse
nate890 is not online. nate890
Joined: 22 Nov 2008
Total Posts: 21686
10 Jan 2012 04:04 PM
King, first time I saw this post by miz, I had no idea what it was supposed to do, so I didn't bother posting.

­<'+1 Post. Ujelly?'>
Report Abuse
miz656 is not online. miz656
Joined: 19 Jul 2010
Total Posts: 15336
10 Jan 2012 04:04 PM
Should I show you the WHOLE script?
Report Abuse
miz656 is not online. miz656
Joined: 19 Jul 2010
Total Posts: 15336
10 Jan 2012 04:06 PM
_G.eliminated = {}
_G.myTable2 = {}
while wait() do
if game.Players.NumPlayers >=2 then
local h = Instance.new("Hint",Workspace)
h.Name = "Round"
for i = 20,0,-1 do
wait(1)
h.Text = "You have "..i.." seconds until the match."
if h.Text == "You have 0 seconds until the match." then
number = math.random(1,#_G.myTable)
game.Players[_G.myTable[number]].Character.Torso.CFrame = CFrame.new(-81.5, 1, 92)
table.insert(_G.myTable2,_G.myTable[number])
table.remove(_G.myTable,number)
wait()
game.Players[_G.myTable[number]].Character.Torso.CFrame = CFrame.new(-32.5, 1, 92)
table.insert(_G.myTable2,_G.myTable[number])
table.remove(_G.myTable,number)
wait(1)
for j = 60,0,-1 do
wait(1)
h.Text = "You have "..j.." seconds until round is over."
end
wait(10)
if game.Players.NumPlayers >=2 then
h:Destroy()
else
end
end
end
end
end
Report Abuse
smurf279 is not online. smurf279
Joined: 15 Mar 2010
Total Posts: 6871
10 Jan 2012 04:11 PM
"if game.Players.NumPlayers >=2 then
h:Destroy()
else
end"
Report Abuse
swimguy777 is not online. swimguy777
Joined: 30 May 2009
Total Posts: 17092
10 Jan 2012 04:12 PM
Name your variables something we can understand. Naming them MyTable and MyTable2 do nothing to tell us what's being stored in them or why they're important.

-[::ƧѡÎḾḠΰῩ::]-[::Maker of stuff and Helper of Scripting::]-
Report Abuse
nate890 is not online. nate890
Joined: 22 Nov 2008
Total Posts: 21686
10 Jan 2012 04:13 PM
Lawl, "Name your variables something we can understand. Naming them MyTable and MyTable2 do nothing to tell us what's being stored in them or why they're important." Exactly why I don't want to see this post again. _G.MyTable, _G.MyTable2, just annoys me whenever seeing that.

­<'+1 Post. Ujelly?'>
Report Abuse
miz656 is not online. miz656
Joined: 19 Jul 2010
Total Posts: 15336
10 Jan 2012 04:14 PM
_G.myTable{} is all the players in that table.
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