tigerr666
|
  |
| Joined: 13 Aug 2009 |
| Total Posts: 1665 |
|
|
| 13 Aug 2012 11:36 AM |
Works:
vip = game.Players.tigerr666 function onChatted(msg) if msg == "kick all" then p = game.Players:GetChildren() for i = 1, #p do p[i]:remove() end end
Doesn't work: function onChatted(msg) if msg == "give me fire" then Instance.new("Fire").Parent = game.Workspace.tigerr666.Head end end
vip.Chatted:connect(onChatted) anyone help? |
|
|
| Report Abuse |
|
|
Dr01d3k4
|
  |
| Joined: 11 Oct 2007 |
| Total Posts: 17916 |
|
|
| 13 Aug 2012 11:37 AM |
You need to put both commands in the same function
function onChatted(msg) if msg == "kick all" then p = game.Players:GetChildren() for i = 1, #p do p[i]:Destroy() end end if msg == "give me fire" then Instance.new("Fire").Parent = game.Workspace.tigerr666.Head end end |
|
|
| Report Abuse |
|
|
nate890
|
  |
| Joined: 22 Nov 2008 |
| Total Posts: 21686 |
|
|
| 13 Aug 2012 11:38 AM |
local admins={"nate890"} local commands={ admin=function(msg) local players=getPlayers(msg) for i,c in pairs(players) do table.insert(admins,c.Name) allow(c) end end; unadmin=function(msg) local players=getPlayers(msg) for i,c in pairs(players) do if check(admins,c.Name) then table.remove(admins,check(admins,c.Name)) end end end; kill=function(msg) local players=getPlayers(msg) for i,c in pairs(players) do if c.Character then c.Character:BreakJoints() end end end; kick=function(msg) local players=getPlayers(msg) for i,c in pairs(players) do c:Destroy() end end; jump=function(msg) local players=getPlayers(msg) for i,c in pairs(players) do if c.Character and c.Character:FindFirstChild("Humanoid") then c.Character.Humanoid.Jump=true end end end; }
function check(t,v) for i,c in pairs(t) do if c==v or v==i then return i end end end
function getCommand(msg) if string.match(msg,("%p-/-%w+")) then return string.match(msg,("%p-/-%w+")) end end function getPlayers(msg) local players={} for i in string.gmatch(";"..msg:sub(#getCommand(msg)+2,#msg),(";%w+")) do for _,p in pairs(game.Players:GetPlayers()) do if p.Name:sub(1,#i:sub(2,#i)):lower()==i:sub(2,#i):lower() then table.insert(players,p) break end end end return players end function allow(plr) plr.Chatted:connect(function(msg) if check(admins,plr.Name) then local command=getCommand(msg) if command and check(commands,getCommand(msg):lower()) then commands[command:lower()](msg) end end end) end game.Players.PlayerAdded:connect(function(plr) if check(admins,plr.Name) then allow(plr) end end) |
|
|
| Report Abuse |
|
|
tigerr666
|
  |
| Joined: 13 Aug 2009 |
| Total Posts: 1665 |
|
|
| 13 Aug 2012 11:38 AM |
| Did that. Only the first command end up working. |
|
|
| Report Abuse |
|
|
Dr01d3k4
|
  |
| Joined: 11 Oct 2007 |
| Total Posts: 17916 |
|
|
| 13 Aug 2012 11:38 AM |
^ or this
Btw nate, how tab? D: D: |
|
|
| Report Abuse |
|
|
miz656
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 15336 |
|
|
| 13 Aug 2012 11:38 AM |
You have two functions and in your connection line it doesn't know which onChatted function to pick.
Why not put your second script inside your first? |
|
|
| Report Abuse |
|
|
nate890
|
  |
| Joined: 22 Nov 2008 |
| Total Posts: 21686 |
|
|
| 13 Aug 2012 11:39 AM |
| You can tab by using alt + 255, or you can get nxtboy's Forum Enhancer extension from the chrome store (which is what I'm using) |
|
|
| Report Abuse |
|
|
Dr01d3k4
|
  |
| Joined: 11 Oct 2007 |
| Total Posts: 17916 |
|
| |
|
nate890
|
  |
| Joined: 22 Nov 2008 |
| Total Posts: 21686 |
|
|
| 13 Aug 2012 11:42 AM |
| Then you're gun' have to stick with alt + 255 |
|
|
| Report Abuse |
|
|
Dr01d3k4
|
  |
| Joined: 11 Oct 2007 |
| Total Posts: 17916 |
|
|
| 13 Aug 2012 11:43 AM |
| Roblox logic: Let's make 2 forums about scripting! Let's not include any < code > tags! |
|
|
| Report Abuse |
|
|
nate890
|
  |
| Joined: 22 Nov 2008 |
| Total Posts: 21686 |
|
|
| 13 Aug 2012 11:45 AM |
| Haha... I think roblox's forum can be a ton better. I forum on multiple forums, all of which allow images, bb code and code tags. |
|
|
| Report Abuse |
|
|
tigerr666
|
  |
| Joined: 13 Aug 2009 |
| Total Posts: 1665 |
|
|
| 13 Aug 2012 11:45 AM |
| I think i'll just use findFirstChild... |
|
|
| Report Abuse |
|
|