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
We use cookies to offer you a better experience. By using Roblox.com, you are agreeing to our Privacy and Cookie Policy.
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Why doesn't this work

Previous Thread :: Next Thread 
UnBuild is not online. 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
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
18 Apr 2013 06:56 PM
Post the whole script, that should insert the name properly.

(╯°□°)> KMXD
Report Abuse
UnBuild is not online. 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
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
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
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