Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why is this erroring? ( Table )

Asked by 10 years ago

So when my name is NOT the first name in my table the script returns saying it cant run my command due to its not my name?!!?! Why would the script not run the command ( aka function ) due to the table not returning everyone in the table? This script has just been a pain since I started but... I will not give up on the script its to far along... Any ideas why it wont let me run the script even though my name is clearly in the table???

local Owners={'YourNameHere','jillmiles1','iLordVex','ReIatively','MessorAdmin'};
local Admins={};


Get_Return_Admin_Table=function(PLR)
local K=false
local Pl=''
for _,v1 in pairs(Owners) do
warn(v1)
if v1:lower()==PLR['Name']:lower() or v1:upper()==PLR['Name']:upper() then
print('Got '..v1)
K=true
Pl=v1
return K
else
K=false
Pl=''
print('Failed '..v1)
return K
end
end
for _,v1 in pairs(Admins) do
warn(v1)
if v1:lower()==PLR['Name']:lower() or v1:upper()==PLR['Name']:upper() then
print('Got '..v1)
K=true
Pl=v1
return K
else
K=false
Pl=''
print('Failed '..v1)
return K
end
end
wait()
return K
end

GETCHATTED=function(PLR,Msg)
Check_Prefix()
for _,DATA in pairs(Gui_Cmds) do
if Msg:sub(1,#(Front_Admin_Prefix..DATA['CMD']:lower()..Back_Admin_Prefix))==(Front_Admin_Prefix..DATA['CMD']:lower()..Back_Admin_Prefix) then
if Get_Return_Admin_Table(PLR) then
Msg=Msg:sub(#Front_Admin_Prefix+#DATA["CMD"]+#Back_Admin_Prefix+1)
DATA['FUNCTION'](PLR,Msg)
else 
Note(PLR,'You Cant Acess This Command!',(255/0/0)) 
end
end
end
end

wait()
game.Players.PlayerAdded:connect(function(I_PLR)
if AutoAdmin==true then table.insert(Owners,I_PLR.Name) else end
I_PLR.Chatted:connect(function(Msg)
GETCHATTED(I_PLR,Msg)
end)
end)

for _,I_PLR in pairs(game.Players:GetPlayers()) do
I_PLR.Chatted:connect(function(Msg)
GETCHATTED(I_PLR,Msg)
end)
end
0
Please tab your code correctly as it makes it much easier to read. Perci1 4988 — 10y
0
Nvm I already fixed it c: MessorAdmin 598 — 10y

Answer this question