Fedorakid
|
  |
| Joined: 17 Jul 2010 |
| Total Posts: 7079 |
|
|
| 07 Mar 2013 09:38 AM |
I made this script a first time but it didnt work so i decided to rewrite it but more advanced and the output says tab is a nil value (i used pairs to get the table) so the script is supposed to teleport those players whos on bright yellow team to a brick (pluss some others in Y) and then teleport to another brick on a certain time:
tab {}
part1 = game.Workspace.Part1 part2 = game.Workspace.Part2
p = game.Players:GetChildren() for i = 1,#players do
if p[i].TeamColor == BrickColor.new("Bright yellow") then table.insert(tab, p[i].Name) for _,v in pairs(tab) do while wait(300) do if v == p[i] then v.Character.Torso.CFrame = part1.CFrame + CFrame.new(0,3,0) wait(25) v.Character.Torso.CFrame = part2.CFrame + CFrame.new(0,3,0) end end end end end
I think it says tab is a nil value because i used pairs on it.But i inserted into the table so i dont get why it doesent get anything T_T |
|
|
| Report Abuse |
|
|
velibor
|
  |
| Joined: 24 Nov 2009 |
| Total Posts: 1003 |
|
|
| 07 Mar 2013 09:46 AM |
tab = {}
part1 = game.Workspace.Part1 part2 = game.Workspace.Part2
p = game.Players:GetChildren()
for i = 1,#p do -- There was no player variable if p[i].TeamColor == BrickColor.new("Bright yellow") then -- Correct table.insert(tab, p[i].Name) -- Correct for _,v in pairs(tab) do -- Correct while wait(300) do -- Correct if v == p[i] then -- Checking or Player still exist ? Then refresh your p ! v.Character.Torso.CFrame = part1.CFrame + CFrame.new(0,3,0) -- Correct wait(25) -- Correct v.Character.Torso.CFrame = part2.CFrame + CFrame.new(0,3,0) -- Corect end -- Ends if loop end -- Ends while loop end -- Ends for loop end -- Ends if loop end -- Extra end added for the for loop ! |
|
|
| Report Abuse |
|
|
Fedorakid
|
  |
| Joined: 17 Jul 2010 |
| Total Posts: 7079 |
|
|
| 07 Mar 2013 09:48 AM |
| There was a player variable.Look at the p. |
|
|
| Report Abuse |
|
|
Fedorakid
|
  |
| Joined: 17 Jul 2010 |
| Total Posts: 7079 |
|
|
| 07 Mar 2013 09:50 AM |
And the ends were right, its 5 end:
for i = 1,#players do if p[i].TeamColor == BrickColor.new("Bright yellow") then for _,v in pairs(tab) do while wait(300) do if v == p[i] then
How many lines can you see? theres one do, one if, one do, one do, one if |
|
|
| Report Abuse |
|
|
Fedorakid
|
  |
| Joined: 17 Jul 2010 |
| Total Posts: 7079 |
|
|
| 07 Mar 2013 09:51 AM |
| Right back where i started >.> |
|
|
| Report Abuse |
|
|
velibor
|
  |
| Joined: 24 Nov 2009 |
| Total Posts: 1003 |
|
|
| 07 Mar 2013 10:01 AM |
player variable wasn't defined. (It was p, not players)
|
|
|
| Report Abuse |
|
|
Fedorakid
|
  |
| Joined: 17 Jul 2010 |
| Total Posts: 7079 |
|
| |
|
Fedorakid
|
  |
| Joined: 17 Jul 2010 |
| Total Posts: 7079 |
|
|
| 07 Mar 2013 10:07 AM |
Do you see any more errors then that?
if game.Players.Fedorakid.FOODHECK = true then annoying = Enabled. |
|
|
| Report Abuse |
|
|
RoflBread
|
  |
| Joined: 18 Jun 2009 |
| Total Posts: 3803 |
|
| |
|
Fedorakid
|
  |
| Joined: 17 Jul 2010 |
| Total Posts: 7079 |
|
|
| 07 Mar 2013 10:18 AM |
^
Wow just wow, im not gona even answer that. |
|
|
| Report Abuse |
|
|
Fedorakid
|
  |
| Joined: 17 Jul 2010 |
| Total Posts: 7079 |
|
|
| 07 Mar 2013 10:22 AM |
| It still doesent work, same error.It still says tab is a nil value.Now like i said is it because when i use pairs on it, i get nothing? because its a clean table with nothing in it but i did do table.insert. |
|
|
| Report Abuse |
|
|
gamert7
|
  |
| Joined: 18 Nov 2008 |
| Total Posts: 4986 |
|
|
| 07 Mar 2013 10:23 AM |
| Because, asking for output is such a horrible thing right? |
|
|
| Report Abuse |
|
|
Fedorakid
|
  |
| Joined: 17 Jul 2010 |
| Total Posts: 7079 |
|
|
| 07 Mar 2013 10:28 AM |
| Look belowest on my thread (not the posts) WHEN I SAY "It says" WHO DO YOU THINK TALK ABOUT? THE ROBLOX MIGHTY GOD!?! Learn reading. |
|
|
| Report Abuse |
|
|
Fedorakid
|
  |
| Joined: 17 Jul 2010 |
| Total Posts: 7079 |
|
| |
|
Fedorakid
|
  |
| Joined: 17 Jul 2010 |
| Total Posts: 7079 |
|
| |
|
Trioxide
|
  |
| Joined: 29 Mar 2011 |
| Total Posts: 32902 |
|
| |
|
Fedorakid
|
  |
| Joined: 17 Jul 2010 |
| Total Posts: 7079 |
|
|
| 07 Mar 2013 11:54 AM |
| Trioxide, reported for spam.I DONT WANT ANY MORE COMPLAINS ABOUT WHY I DONT SAY OUTPUT, BECAUSE I SAID IT IN THE THREAD. |
|
|
| Report Abuse |
|
|
Fedorakid
|
  |
| Joined: 17 Jul 2010 |
| Total Posts: 7079 |
|
| |
|
|
| 07 Mar 2013 12:58 PM |
v == p[i]
If I am not mistaken, v is p[i].Name not p[i]. Also, you are waiting 300 seconds and then assuming that players and characters haven't gone nil (left the server).
I am not sure exactly what you are trying to achieve, but I have a feeling that there is another way to do it. |
|
|
| Report Abuse |
|
|
Fedorakid
|
  |
| Joined: 17 Jul 2010 |
| Total Posts: 7079 |
|
|
| 07 Mar 2013 01:07 PM |
Kk so would this work then:
tab {}
part1 = game.Workspace.Part1 part2 = game.Workspace.Part2
p = game.Players:GetChildren() for i = 1,#p do
if p[i].TeamColor == BrickColor.new("Bright yellow") then table.insert(tab, p[i].Name) for _,v in pairs(tab) do while wait(300) do if v == p[i].Name then v.Character.Torso.CFrame = part1.CFrame + CFrame.new(0,3,0) wait(25) v.Character.Torso.CFrame = part2.CFrame + CFrame.new(0,3,0) end end end end end |
|
|
| Report Abuse |
|
|
|
| 07 Mar 2013 01:31 PM |
It should be tab = { }. Can you explain what you want a little more?
¤ ¤ † K M <( •д• )> X D † ¤ ¤ |
|
|
| Report Abuse |
|
|
|
| 07 Mar 2013 01:41 PM |
I see, you explained it on another thread.
local tab = { } local part1 = game.Workspace.Part1 local part2 = game.Workspace.Part2 while wait(300) do local p = game.Players:GetPlayers() for i = 1, #p do if p[i].TeamColor == BrickColor.new("Bright yellow") then table.insert(tab, p[i].Name) end end for _,v in pairs(tab) do if Workspace:FindFirstChild( v ) then Workspace[v].Character.Torso.CFrame = part1.CFrame + CFrame.new(0,3,0) wait(25) Workspace[v].Character.Torso.CFrame = part2.CFrame + CFrame.new(0,3,0) end end end
Not entirely sure, tell me how it goes.
¤ ¤ † K M <( •д• )> X D † ¤ ¤ |
|
|
| Report Abuse |
|
|
Fedorakid
|
  |
| Joined: 17 Jul 2010 |
| Total Posts: 7079 |
|
|
| 07 Mar 2013 01:43 PM |
| WTF? i DIDNT WRITE A TABLE CORRECTLY OMG, BIG TYPO ALERT!! |
|
|
| Report Abuse |
|
|
Fedorakid
|
  |
| Joined: 17 Jul 2010 |
| Total Posts: 7079 |
|
|
| 07 Mar 2013 01:43 PM |
| NOW IT MAKES SENCE WHY OUTPUT SAID TAB IS A NIL VALUE, I DIDNT DO IT CORRECTLY :O any other error :o? |
|
|
| Report Abuse |
|
|
|
| 07 Mar 2013 01:48 PM |
Not really, I just organized the code differently.
¤ ¤ † K M <( •д• )> X D † ¤ ¤ |
|
|
| Report Abuse |
|
|