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: WHATS WRONG WITH THIS!

Previous Thread :: Next Thread 
Fedorakid is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. Fedorakid
Joined: 17 Jul 2010
Total Posts: 7079
07 Mar 2013 09:51 AM
Right back where i started >.>
Report Abuse
velibor is not online. 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 is not online. Fedorakid
Joined: 17 Jul 2010
Total Posts: 7079
07 Mar 2013 10:06 AM
Oh typo..
Report Abuse
Fedorakid is not online. 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 is not online. RoflBread
Joined: 18 Jun 2009
Total Posts: 3803
07 Mar 2013 10:13 AM
Output?
Report Abuse
Fedorakid is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. Fedorakid
Joined: 17 Jul 2010
Total Posts: 7079
07 Mar 2013 10:56 AM
bump
Report Abuse
Fedorakid is not online. Fedorakid
Joined: 17 Jul 2010
Total Posts: 7079
07 Mar 2013 11:24 AM
BUMPEH BEAR >:O
Report Abuse
Trioxide is not online. Trioxide
Joined: 29 Mar 2011
Total Posts: 32902
07 Mar 2013 11:43 AM
[ Content Deleted ]
Report Abuse
Fedorakid is not online. 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 is not online. Fedorakid
Joined: 17 Jul 2010
Total Posts: 7079
07 Mar 2013 12:42 PM
bumpz
Report Abuse
SolarCrane is not online. SolarCrane
Forum Moderator
Joined: 03 Jul 2012
Total Posts: 116
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 is not online. 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
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
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
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
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 is not online. 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 is not online. 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
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
07 Mar 2013 01:48 PM
Not really, I just organized the code differently.

¤ ¤ † K M <( •д• )> X D † ¤ ¤
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