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

Chatted connect (Tables) ???

Asked by 9 years ago

I cant seem to get this to work. I have had this work on another Admin Prompt I created but... it didn't have ranking, it was localplayer so maybe you can help me . :)

Settings={
['Commands']={};
['Prefix']=";";
}

Cmd=function(Rank,Name,Command,Desc,Args,Func)
table.insert(Settings.Commands,{Rank=Rank,Name=Name,Command=Command,Desc=Desc,Args=Args,Func=Func})
end

OnChatted=function(plr,msg) 
ypcall(function()
for usage,data in next,Settings.Commands do
if (usage..Settings==math.sub(1,#usage+#Settings.Prefix)) then
if (GetRank(plr)>=usage)then
local r,e=ypcall(function()
data.Func(plr,msg:lower():sub(#usage+2));
end);
if(not r)then
Tablet(plr,'Really red',e,function()end);
end;
else
Tablet(plr,'Really red','Your rank is too low for that command',function() end);
end;
end;
end;
end);
end;

game:service'Players'.PlayerAdded:connect(function(plr) plr.Chatted:connect(function(m)
OnChatted(plr,m)
end) end)

for _, v in pairs(game.Players:GetPlayers()) do v.Chatted:connect(function(m) OnChatted(v,m) end) end

Answer this question