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
|
  |
| 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
|
  |
| 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 |
|
|
|
| 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 |
|
|
|
| 30 Sep 2015 07:53 PM |
Oops, I meant if admins[player.Name] then
-The [Guy] |
|
|
| Report Abuse |
|
|
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 |
|
|
|
| 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
|
  |
| 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 |
|
|
|
| 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
|
  |
| Joined: 16 Feb 2013 |
| Total Posts: 359 |
|
| |
|
|
| 30 Sep 2015 08:15 PM |
I literally just posted the code
-The [Guy] |
|
|
| Report Abuse |
|
|
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
|
  |
| Joined: 16 Feb 2013 |
| Total Posts: 359 |
|
| |
|
|
| 01 Oct 2015 04:22 PM |
I literally just posted the code [2]
-The [Guy] |
|
|
| Report Abuse |
|
|
Zakusa
|
  |
| Joined: 16 Feb 2013 |
| Total Posts: 359 |
|
|
| 01 Oct 2015 04:25 PM |
| ya the wait() didnt help :( |
|
|
| Report Abuse |
|
|
|
| 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
|
  |
| 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 |
|
|
|
| 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
|
  |
| 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 |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
| |
|
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 |
|
|