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: Admin commands help

Previous Thread :: Next Thread 
evolvedpikachu is not online. evolvedpikachu
Joined: 18 Aug 2010
Total Posts: 10696
05 Jan 2014 05:49 PM
I'm getting this error:

attempt to call field "Effect" (a nil value)

What did I do wrong with my admin commands? Here is the line that errors:

command.Effect(player,msg)

and here is the script:



admins = {evolvedpikachu = 10}

banned = {"urmom"} -- For all the banned players

commands = {
{
Effect = function(player,msg) Instance.new("Message",Workspace).Text = player.Name.." has said "..msg end;
Rank = 1;
Words = {"test"}
}
}

function IsValid(player,list,isdictionary,rank)

if isdictionary then
-- If it is a dictionary
if list[player.Name] and not rank then -- if I am not checking for rank, just if it's there
return true
elseif list[player.Name] and rank then -- if I am checking for rank AND if it's there
if tonumber(list[player.Name]) then
if list[player.Name] >= rank then
return true
end
end
end

elseif not isdictionary then
-- If it is not a dictionary
for i, v in pairs(list) do
if player.Name == v then
return true
end
end
end

return false
end

game.Players.PlayerAdded:connect(function(player)

if IsValid(player,banned) then -- Is the player in the banned list?
player:Kick()
end

if IsValid(player,admins,true) then -- If you are in the admins table then you will be connected to the Chatted event
player.Chatted:connect(function(msg)
for i, command in pairs(commands) do
for i, v in pairs(command.Words) do
if msg:match(v) and IsValid(player,admins,true,command.Rank) then
command.Effect(player,msg)
end
end
end
end)
end
end)
Report Abuse
evolvedpikachu is not online. evolvedpikachu
Joined: 18 Aug 2010
Total Posts: 10696
05 Jan 2014 08:33 PM
Bet you thought I was a Kohl's Admin scrub.
Report Abuse
VilleSlay is not online. VilleSlay
Joined: 14 May 2011
Total Posts: 1405
05 Jan 2014 08:37 PM
>Trying to get a function from a table named command when the table is named commands.
> Trying to get it as if it was a Java class.

~~> Ville <~~
Report Abuse
evolvedpikachu is not online. evolvedpikachu
Joined: 18 Aug 2010
Total Posts: 10696
05 Jan 2014 08:38 PM
@Ville

LOL I JUST NOTICED THAT

Also idk Java so idk what you mean by that.
Report Abuse
evolvedpikachu is not online. evolvedpikachu
Joined: 18 Aug 2010
Total Posts: 10696
05 Jan 2014 08:42 PM
@Ville

Actually, that was on purpose. Look closely, command is something in the commands table.

for i, command in pairs(commands) do
for i, v in pairs(command.Words) do
if msg:match(v) and IsValid(player,admins,true,command.Rank) then
command.Effect(player,msg)
end
end
end
Report Abuse
VilleSlay is not online. VilleSlay
Joined: 14 May 2011
Total Posts: 1405
05 Jan 2014 08:47 PM
Looping, you're not doing it right.

~~> Ville <~~
Report Abuse
evolvedpikachu is not online. evolvedpikachu
Joined: 18 Aug 2010
Total Posts: 10696
05 Jan 2014 08:49 PM
Huh, I somehow got it to work. Even though I did literally nothing but a bunch of test theories. kthxbai
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