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 issue

Previous Thread :: Next Thread 
TheBenSquare is not online. TheBenSquare
Joined: 13 Dec 2009
Total Posts: 13604
18 Aug 2014 11:38 AM
admins = {"TheBenSquare", "mindlessderp", "tharmilkman"}
commands = {"Open/Alpha", "Close/Alpha", "Open/Delta", "Close/Delta"}

while wait() do
game.Players.PlayerAdded:connect(function(plyr)
for i,v in pairs(admins) do
if plyr.Name == v
then
v.Chatted:connect(function(msg)
if msg == "Open/Alpha"
then
game.ServerStorage["Team Alpha"].Parent = game.Teams

elseif msg == "Close/Alpha"
then
game.Teams["Team Alpha"].Parent = game.ServerStorage

elseif msg == "Open/Delta"
then
game.ServerStorage["Team Delta"].Parent = game.Teams

elseif msg == "Close/Delta"
then
game.Teams["Team Delta"].Parent = game.ServerStorage

elseif msg == "cmds"
then
for i,z in pairs(commands) do
g = Instance.new("Message", v.PlayerGui)
g.Text = commands
end
end
end)
end
end
end)
end

I'm trying to make it so anyone thats in the "admins" list has access to these commands but oddly none of them work. Nothing is outlined as red or nil.

- USA Deputy Secretary of the Treasury
Report Abuse
DaMrNelson is not online. DaMrNelson
Joined: 27 Jul 2009
Total Posts: 4405
18 Aug 2014 12:07 PM
First off, why are your player added event in a loop? You can just take away the "while wait() do" loop and it will still work the same (except with your loop commands will be run like 50 billion times).

Anyways, I think the problem is actually your loop. When you run a command you're probably ending up running it a few thousand-million times, which lags out the server and stops you from seeing the effect (since the server is no longer replicating, its too busy thinking).

If that doesn't fix it you could always try making a more simple command like "hi" that creates a new message in Workspace. Your playerlist may not be updating.

Wiki Profile: http://wiki.roblox.com/index.php/User:Nelson
Report Abuse
devonson4 is not online. devonson4
Joined: 10 Apr 2011
Total Posts: 154
18 Aug 2014 12:09 PM
Try placing game.ServerStorage["Team Delta"]:Clone() ect before parenting them.
Report Abuse
TheBenSquare is not online. TheBenSquare
Joined: 13 Dec 2009
Total Posts: 13604
18 Aug 2014 12:13 PM
@DaMr,

Alright, removed the while wait() do along with the end for that and it still doesn't work.

@devonson4,

Those commands work fine in other command scripts, but in this one it doesn't work. The other ones had a few bugs but worked. I made a new one, which is this one, and now doesn't work.

- USA Deputy Secretary of the Treasury
Report Abuse
DaMrNelson is not online. DaMrNelson
Joined: 27 Jul 2009
Total Posts: 4405
18 Aug 2014 12:15 PM
@TheBenSquare
Did you try the basic "hi" command? Also, I took another look at your script and found that your "cmds" command isn't work because its trying to parent the message to v.PlayerGui, but v is nil. Try parenting to plyr.PlayerGui.
Also, remember that you can check the server-side output at places you own by using F9 and going to the server tab.

Wiki Profile: http://wiki.roblox.com/index.php/User:Nelson
Report Abuse
TheBenSquare is not online. TheBenSquare
Joined: 13 Dec 2009
Total Posts: 13604
18 Aug 2014 12:37 PM
@Da,

Just tried a basic "hi" admin script, didn't work.

admins = {"TheBenSquare"}

game.Players.PlayerAdded:connect(function(plyr)
wait(1)
for i,v in pairs(admins) do
if plyr.Name == v
then
v.Chatted:connect(function(msg)
if msg == "hi"
then
g = Instance.new("Message", game.Workspace)
g.Text = "Hi!"
wait(15)
g:Destroy()
end
end)
end
end
end)

I checked the server side output and it said this:

"httpGet failed. Trying again. Elapsed time: 0.413979
Content failed because Not Found
Workspace.Script:8 attempt to index field "chatted" (a nil value)
Stack Begin
Script 'Workspace.Script', line 8
Stack End"

What caught my eye is that it called chatted a nil value. How so?

- USA Deputy Secretary of the Treasury
Report Abuse
DaMrNelson is not online. DaMrNelson
Joined: 27 Jul 2009
Total Posts: 4405
18 Aug 2014 12:54 PM
Oops sorry, I must have misread your script.

You are again treating v as the player (in this case it is a string). Use plyr.Chatted, not v.Chatted.

Wiki Profile: http://wiki.roblox.com/index.php/User:Nelson
Report Abuse
TheBenSquare is not online. TheBenSquare
Joined: 13 Dec 2009
Total Posts: 13604
18 Aug 2014 12:59 PM
@DaMr,

Ah, that worked. Just did that to the original script and now the original script partially works. The commands for opening and closing the teams work but the "cmd" command doesn't work. (It does nothing when I say cmds)

- USA Deputy Secretary of the Treasury
Report Abuse
DaMrNelson is not online. DaMrNelson
Joined: 27 Jul 2009
Total Posts: 4405
18 Aug 2014 01:11 PM
You are trying to put a table as the text of a message. Try:
g.Text = "Commands: " .. table.concat(commands, ", ")

Wiki Profile: http://wiki.roblox.com/index.php/User:Nelson
Report Abuse
TheBenSquare is not online. TheBenSquare
Joined: 13 Dec 2009
Total Posts: 13604
18 Aug 2014 01:26 PM
@DaMr,

Just did that, now I tried to say "cmds" at the game and it didn't do anything.

- USA Deputy Secretary of the Treasury
Report Abuse
TheBenSquare is not online. TheBenSquare
Joined: 13 Dec 2009
Total Posts: 13604
18 Aug 2014 08:29 PM
B1
Report Abuse
SenseiWarrior is online. SenseiWarrior
Joined: 09 Apr 2011
Total Posts: 12140
18 Aug 2014 08:31 PM
game.Players.PlayerAdded:connect(function(plyr)
for i,v in pairs(admins) do
if plyr.Name == v then
plyr.Chatted:connect(function(msg)
if msg == "Open/Alpha" then
game.ServerStorage["Team Alpha"].Parent = game.Teams
elseif msg == "Close/Alpha" then
game.Teams["Team Alpha"].Parent = game.ServerStorage
elseif msg == "Open/Delta" then
game.ServerStorage["Team Delta"].Parent = game.Teams
elseif msg == "Close/Delta" then
game.Teams["Team Delta"].Parent = game.ServerStorage
elseif msg == "cmds" then
for i,z in pairs(commands) do
g = Instance.new("Message", v.PlayerGui)
g.Text = commands
end
end
end)
end
end
end)
Report Abuse
SenseiWarrior is online. SenseiWarrior
Joined: 09 Apr 2011
Total Posts: 12140
18 Aug 2014 08:31 PM
game.Players.PlayerAdded:connect(function(plyr)
for i,v in pairs(admins) do
if plyr.Name == v then
plyr.Chatted:connect(function(msg)
if msg == "Open/Alpha" then
game.ServerStorage["Team Alpha"].Parent = game.Teams
elseif msg == "Close/Alpha" then
game.Teams["Team Alpha"].Parent = game.ServerStorage
elseif msg == "Open/Delta" then
game.ServerStorage["Team Delta"].Parent = game.Teams
elseif msg == "Close/Delta" then
game.Teams["Team Delta"].Parent = game.ServerStorage
elseif msg == "cmds" then
for i,z in pairs(commands) do
g = Instance.new("Message", plyr.PlayerGui)
g.Text = commands
end
end
end)
end
end
end)
Report Abuse
TheBenSquare is not online. TheBenSquare
Joined: 13 Dec 2009
Total Posts: 13604
18 Aug 2014 08:34 PM
@Sensei, the issue with the script itself is fixed now, I need assistance with getting "cmds" to show the list of commands now. The one Da said didn't work.
Report Abuse
SenseiWarrior is online. SenseiWarrior
Joined: 09 Apr 2011
Total Posts: 12140
18 Aug 2014 08:36 PM
local g = Instance.new("Message", plyr.PlayerGui)
for i,z in pairs(commands) do
g.Text = g.Text..z
end
game:GetService"Debris":AddItem(g,10)
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