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 » Scripters
Home Search
 

Re: making admin commands

Previous Thread :: Next Thread 
Zakusa is not online. Zakusa
Joined: 16 Feb 2013
Total Posts: 359
30 Sep 2015 07:49 PM
can someone fix this plz

local admins = "Zakusa", "Roblox" -- EXAMPLE
game.Players.PlayerAdded:connect(function(player)
player.Chatted:connect(function(msg)
if admins and msg == "hi" then
print("Hello world")
end
end)
end)
Report Abuse
rayk999 is not online. rayk999
Joined: 18 Feb 2011
Total Posts: 4705
30 Sep 2015 07:50 PM
i recommend you learn how to script first


Red Blossoms
Report Abuse
Zakusa is not online. Zakusa
Joined: 16 Feb 2013
Total Posts: 359
30 Sep 2015 07:52 PM
ya your correct i should stop being lazy and go to roblox forums and do it
Report Abuse
BusyCityGuy is not online. BusyCityGuy
Joined: 17 Aug 2012
Total Posts: 2144
30 Sep 2015 07:52 PM
local admins = {["Zakusa"] = true, ["Roblox"] = true}
game.Players.PlayerAdded:connect(function(player)
if admins[player] then
player.Chatted:connect(function(msg)
if msg:sub(1, 3) == "/hi" then
print("Hi.")
end
end)
end
end)

-The [Guy]
Report Abuse
BusyCityGuy is not online. BusyCityGuy
Joined: 17 Aug 2012
Total Posts: 2144
30 Sep 2015 07:53 PM
Oops, I meant
if admins[player.Name] then

-The [Guy]
Report Abuse
Zakusa is not online. Zakusa
Joined: 16 Feb 2013
Total Posts: 359
30 Sep 2015 07:56 PM
ya that looks cool but its not working and msg:sub sounds disgusting
Report Abuse
BusyCityGuy is not online. BusyCityGuy
Joined: 17 Aug 2012
Total Posts: 2144
30 Sep 2015 08:01 PM
"it's not working"
Not very descriptive, tell me what the error is.
I used msg:sub() because if you want to implement something in the future with variable text after the / command, then you want it to be able to split up the command into sections it needs, oh nevermind, if you don't want it then take it out. I really don't care, it's your code now.

-The [Guy]
Report Abuse
Zakusa is not online. Zakusa
Joined: 16 Feb 2013
Total Posts: 359
30 Sep 2015 08:05 PM
wait it works but i has to rejoin for it to work how do i make it work like without hasing to rejoin like if i disable and enable the script it works
Report Abuse
BusyCityGuy is not online. BusyCityGuy
Joined: 17 Aug 2012
Total Posts: 2144
30 Sep 2015 08:10 PM
Hmm. Sounds like it's running too early or something.

local admins = {["Zakusa"] = true, ["Roblox"] = true}
game.Players.PlayerAdded:connect(function(player)
if admins[player.Name] then
player.CharacterAdded:wait()
player.Chatted:connect(function(msg)
if msg:sub(1, 3) == "/hi" then
print("Hi.")
end
end)
end
end)

Add a wait for the character like that or something maybe.
-The [Guy]
Report Abuse
Zakusa is not online. Zakusa
Joined: 16 Feb 2013
Total Posts: 359
30 Sep 2015 08:13 PM
ya i dont know how
Report Abuse
BusyCityGuy is not online. BusyCityGuy
Joined: 17 Aug 2012
Total Posts: 2144
30 Sep 2015 08:15 PM
I literally just posted the code

-The [Guy]
Report Abuse
Zakusa is not online. Zakusa
Joined: 16 Feb 2013
Total Posts: 359
30 Sep 2015 08:19 PM
o ya i didnt read it all but it didnt work
Report Abuse
Zakusa is not online. Zakusa
Joined: 16 Feb 2013
Total Posts: 359
01 Oct 2015 04:16 PM
bumpity bump help
Report Abuse
BusyCityGuy is not online. BusyCityGuy
Joined: 17 Aug 2012
Total Posts: 2144
01 Oct 2015 04:22 PM
I literally just posted the code [2]

-The [Guy]
Report Abuse
Zakusa is not online. Zakusa
Joined: 16 Feb 2013
Total Posts: 359
01 Oct 2015 04:25 PM
ya the wait() didnt help :(
Report Abuse
BusyCityGuy is not online. BusyCityGuy
Joined: 17 Aug 2012
Total Posts: 2144
01 Oct 2015 04:28 PM
Did you re-copy paste my latest code? it was more than just a wait()

-The [Guy]
Report Abuse
Zakusa is not online. Zakusa
Joined: 16 Feb 2013
Total Posts: 359
01 Oct 2015 04:30 PM
idk this was your latest one

local admins = {["Zakusa"] = true, ["Roblox"] = true}
game.Players.PlayerAdded:connect(function(player)
if admins[player.Name] then
player.CharacterAdded:wait()
player.Chatted:connect(function(msg)
if msg:sub(1, 3) == "/hi" then
print("Hi.")
end
end)
end
end)
Report Abuse
InsaneDays is not online. InsaneDays
Joined: 28 Jan 2012
Total Posts: 762
01 Oct 2015 04:30 PM

1. Use playerIds.
2. For commands always use string.lower for efficacy.
3. Don't make it "check" that you're an admin everytime you type something.
Report Abuse
Zakusa is not online. Zakusa
Joined: 16 Feb 2013
Total Posts: 359
01 Oct 2015 04:32 PM
ya plz no i like using username i dont like using id but kohls works fien
Report Abuse
InsaneDays is not online. InsaneDays
Joined: 28 Jan 2012
Total Posts: 762
01 Oct 2015 04:34 PM
local adminsIDs = {
YourId,
idk,
whatever
}

local prefix = "/"
game:GetService("Players").PlayerAdded:connect(function(playar)
local admin = false
for i,v in pairs(adminsIDs) do
if v == playar.userId then
admin = true
break
end
end
if admin then
playar.Chatted:connect(function(msg)
if string.lower(msg:sub(1,string.len(prefix))) == string.lower(prefix) then
if string.lower(msg:sub(2,string.len(msg))) == "hi" then
print("Hi")
end
end
end)
end
end)
Report Abuse
InsaneDays is not online. InsaneDays
Joined: 28 Jan 2012
Total Posts: 762
01 Oct 2015 04:35 PM
IDs are more efficent than player names. If a player gets banned he can bypass the ban by changing the name.
Report Abuse
BusyCityGuy is not online. BusyCityGuy
Joined: 17 Aug 2012
Total Posts: 2144
01 Oct 2015 04:36 PM
I like mine better, I just didn't use player ID's and :lower() which I probably should have. :/

-The [Guy]
Report Abuse
InsaneDays is not online. InsaneDays
Joined: 28 Jan 2012
Total Posts: 762
01 Oct 2015 04:36 PM
Actually there's a little glitch in the script i gave you but i'm too lazy to fix it lol.
Report Abuse
darkstriken is not online. darkstriken
Joined: 23 Oct 2010
Total Posts: 376
01 Oct 2015 04:36 PM
insane, that code sucks
Report Abuse
Zakusa is not online. Zakusa
Joined: 16 Feb 2013
Total Posts: 359
01 Oct 2015 04:37 PM
plz no that script looks hard i want a easy one all i do is make easy script do big things
liek i dont want it to be that big
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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