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 » Scripters
Home Search
 

Re: bad argument to pairs, table

Previous Thread :: Next Thread 
iamsmartcookie is not online. iamsmartcookie
Joined: 18 Aug 2012
Total Posts: 2738
05 Jun 2015 07:34 PM
Menu.Frame.TeamChange.Load:33 bad argument to pairs (table expected, got nil)
33 and 68

Line 33:

function PlayerIsMegaAdmin(dude)
for i,v in pairs(_G.MostValublePeople)do -- 33
if string.lower(dude.Name) == string.lower(v) then
return true
end
end
end

if PlayerIsMegaAdmin(plr) then --68
table.insert(setup.Developers,plr.Name)
end
Report Abuse
rayk999 is not online. rayk999
Joined: 18 Feb 2011
Total Posts: 4705
05 Jun 2015 07:36 PM
put somewhere above this

repeat wait() until _G.MostValuablePeople ~= nil

I think you also meant to spell MostValuablePeople.
Report Abuse
iamsmartcookie is not online. iamsmartcookie
Joined: 18 Aug 2012
Total Posts: 2738
05 Jun 2015 07:40 PM
no error, e.e more of script:

plr = game.Players.LocalPlayer
repeat wait() until _G.MostValuablePeople ~= nil

setup = {
Developers = {},
}

function PlayerIsMegaAdmin(dude)
for i,v in pairs(_G.MostValublePeople)do
if string.lower(dude.Name) == string.lower(v) then
return true
end
end
end



local function checkAccess(tab, name)
for _,v in pairs(tab) do
if v:lower() == name:lower() then
return true
end
end
return false
end

for i,v in pairs(teams) do
if (type(setup[v.Name]) == "table" and not checkAccess(setup[v.Name], game.Players.LocalPlayer.Name)) or (type(setup[v.Name]) == "number" and not game.Players.LocalPlayer:IsInGroup(setup[v.Name])) then
teams[i] = false
end
end

if PlayerIsMegaAdmin(plr) then
table.insert(setup.Developers,plr.Name)
end

for i = 1, #teams do
if teams[i] ~= false then
if num2 >= 1 then
num2 = 0
num4 = num4 +35
end
if tteams == 1 then
script.Parent.ScrollingEnabled = true
end
local T2 = template:clone()
T2.Visible = true
T2.Parent = script.Parent
T2.Text = #teams[i].Name > 20 and acronym(teams[i].Name) or teams[i].Name
T2.TextLabel.BackgroundColor = teams[i].TeamColor
T2.Position = UDim2.new(num2, num3, num1, num4)
num1 = num1 +.25
tteams = tteams +1
end
end
end
game.Players.LocalPlayer.CharacterAdded:connect(onspawned)
Report Abuse
rayk999 is not online. rayk999
Joined: 18 Feb 2011
Total Posts: 4705
05 Jun 2015 07:42 PM
Did you spell everything correctly? even in the other script declaring MostValuablePeople

In the Generic for loop, I still see it spelt: _G.MostValublePeople. Is that how you spelt it in the script declaring it? If so, then change my line
Report Abuse
iamsmartcookie is not online. iamsmartcookie
Joined: 18 Aug 2012
Total Posts: 2738
05 Jun 2015 07:49 PM
It's all spelled MostValublePeople

here is MVP script:

SpecialPeople = {
{
Name = "Player1",
Title = "Founder",
UserID = -1,
All = true,
};
{
Name = "iamsmartcookie",
Title = "Developer",
UserID = 31313597,
All = true,
};
}

Administration = {
President = {
Name = "name",
UserID = -1,
} ;
VicePresident = {
Name = "name",
UserID = -1,
}
}

_G.MostValublePeople = {}
_G.vips = {}

_G.Developers = {}
_G.Founders = {}
_G.Builders = {}

_G.POTUS = Administration.President.Name
_G.VPOTUS = Administration.VicePresident.Name


function SetGlobals()

for i,v in pairs(SpecialPeople)do
if(v.All == true)then
table.insert(_G.MostValublePeople, v.Name)
else
table.insert(_G.vips, v.Name)
end

if(v.Title == "Developer")then
table.insert(_G.Developers, v.Name)
elseif(v.Title == "Founder")then
table.insert(_G.Founders, v.Name)
elseif(v.Title == "Builder")then
table.insert(_G.Builders, v.Name)
end

end
Report Abuse
rayk999 is not online. rayk999
Joined: 18 Feb 2011
Total Posts: 4705
05 Jun 2015 07:51 PM
repeat wait() until _G.MostValublePeople ~= nil

u mite want to spel it korectlie later doe
Report Abuse
iamsmartcookie is not online. iamsmartcookie
Joined: 18 Aug 2012
Total Posts: 2738
05 Jun 2015 07:52 PM
nop qq
Report Abuse
iamsmartcookie is not online. iamsmartcookie
Joined: 18 Aug 2012
Total Posts: 2738
05 Jun 2015 07:56 PM
qqqq
Report Abuse
rayk999 is not online. rayk999
Joined: 18 Feb 2011
Total Posts: 4705
05 Jun 2015 07:56 PM
new idea:

dont use _G

use modulescripts
Report Abuse
iamsmartcookie is not online. iamsmartcookie
Joined: 18 Aug 2012
Total Posts: 2738
05 Jun 2015 08:09 PM
can you call a global table through a local script
Report Abuse
rayk999 is not online. rayk999
Joined: 18 Feb 2011
Total Posts: 4705
05 Jun 2015 08:10 PM
localscript _G tables are the same only locally. they do not have the same _G table as the server or other clients
Report Abuse
iamsmartcookie is not online. iamsmartcookie
Joined: 18 Aug 2012
Total Posts: 2738
05 Jun 2015 08:21 PM
ohh thats why, e.e I was thinking since I can't use HttpService in local, I'd use a global table and use it in serverscript and call the table through local.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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