UnBuild
|
  |
| Joined: 22 Mar 2013 |
| Total Posts: 3233 |
|
|
| 18 Apr 2013 06:54 PM |
I'm making a admin script and there is a table called "Admins"
if string.lower(string.sub(msg,1,6)) == "admin/" then table.insert(Admins,string.sub(msg,7)) end
Why does this not make a player a admin?
I can post the whole script if needed |
|
|
| Report Abuse |
|
|
|
| 18 Apr 2013 06:56 PM |
Post the whole script, that should insert the name properly.
(╯°□°)> KMXD |
|
|
| Report Abuse |
|
|
UnBuild
|
  |
| Joined: 22 Mar 2013 |
| Total Posts: 3233 |
|
|
| 18 Apr 2013 06:57 PM |
The other commands work fine, so they aren't the problem (Most likely)
Admins = {"UnBuild","UnBuilding"}
function CanScript(PlayerName) for Number = 1,#Admins do if PlayerName == Admins[Number] then return true end end return false end
function Talked(msg)
if script:FindFirstChild("PlayerScripts") == nil then Instance.new("Model",script).Name = "PlayerScripts" end
if string.lower(string.sub(msg,1,2)) == "s/" then NewScript = script.BlankScript:Clone() NewScript.Scripting.Value = string.sub(msg,3) NewScript.Name = "Script" NewScript.Disabled = false NewScript.Parent = script.PlayerScripts end
if string.lower(string.sub(msg,1,5)) == "/stop" then script.PlayerScripts:ClearAllChildren() end
if string.lower(string.sub(msg,1,6)) == "admin/" then table.insert(Admins,string.sub(msg,7)) end
end
function PlayerJoined(Player) if CanScript(Player.Name) then Player.Chatted:connect(Talked) end end game.Players.PlayerAdded:connect(PlayerJoined) |
|
|
| Report Abuse |
|
|
|
| 18 Apr 2013 07:00 PM |
You're only checking the table for admins when they enter.
Try this:
Admins = {"UnBuild","UnBuilding"} function CanScript(PlayerName) for Number = 1,#Admins do if PlayerName == Admins[Number] then return true end end return false end function Talked(msg, Player) if not CanScript(Player) then return end if script:FindFirstChild("PlayerScripts") == nil then Instance.new("Model",script).Name = "PlayerScripts" end if string.lower(string.sub(msg,1,2)) == "s/" then NewScript = script.BlankScript:Clone() NewScript.Scripting.Value = string.sub(msg,3) NewScript.Name = "Script" NewScript.Disabled = false NewScript.Parent = script.PlayerScripts end if string.lower(string.sub(msg,1,5)) == "/stop" then script.PlayerScripts:ClearAllChildren() end if string.lower(string.sub(msg,1,6)) == "admin/" then table.insert(Admins,string.sub(msg,7)) end end function PlayerJoined(Player) Player.Chatted:connect(function(Chat) Talked(Chat, Player.Name) end) end game.Players.PlayerAdded:connect(PlayerJoined)
(╯°□°)> KMXD |
|
|
| Report Abuse |
|
|