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 need help!

Previous Thread :: Next Thread 
DiabetiikZombie123 is not online. DiabetiikZombie123
Joined: 18 Jan 2011
Total Posts: 285
21 Jan 2012 07:22 PM
local nameList = {
["DiabetiikZombie123"] = true;
["badboy123349"] = true;
["breckin12"] = true
}

-- Edit the table above to suit your needs

game:GetService("Players").PlayerAdded:connect(function(playerObject)
if nameList[playerObject.Name] then
playerObject.Chatted:connect(function(stringChat)
if string.lower(stringChat) == "reset" then
playerObject.Character:BreakJoints()
end
end)
end
end)



game:GetService("Players").PlayerAdded:connect(function(playerObject)
if nameList[playerObject.Name] then
playerObject.Chatted:connect(function(stringChat)
if string.lower(stringChat) == "faster" then
playerObject.Character.Humanoid.WalkSpeed = 32
end
end)
end
end)



game:GetService("Players").PlayerAdded:connect(function(playerObject)
if nameList[playerObject.Name] then
playerObject.Chatted:connect(function(stringChat)
if string.lower(stringChat) == "jump" then
playerObject.Character.Humanoid.Jump = true
end
end)
end
end)



game:GetService("Players").PlayerAdded:connect(function(playerObject)
if nameList[playerObject.Name] then
playerObject.Chatted:connect(function(stringChat)
if string.lower(stringChat) == "sit" then
playerObject.Character.Humanoid.Sit = true
end
end)
end
end)



game:GetService("Players").PlayerAdded:connect(function(playerObject)
if nameList[playerObject.Name] then
playerObject.Chatted:connect(function(stringChat)
if string.lower(stringChat) == "naked" then
playerObject.Character.Shirt:remove()
playerObject.Character.Pants:remove()
end
end)
end
end)



game:GetService("Players").PlayerAdded:connect(function(playerObject)
if nameList[playerObject.Name] then
playerObject.Chatted:connect(function(stringChat)
if string.lower(stringChat) == "slower" then
playerObject.Character.Humanoid.WalkSpeed = 16
end
end)
end
end)



will this work?
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
21 Jan 2012 07:23 PM
No.

† KMXD †
Report Abuse
DiabetiikZombie123 is not online. DiabetiikZombie123
Joined: 18 Jan 2011
Total Posts: 285
21 Jan 2012 07:24 PM
fix?
Report Abuse
Cyrok is not online. Cyrok
Joined: 11 Jan 2012
Total Posts: 630
21 Jan 2012 07:25 PM
Instead of having each command have its own separate event, use an elseif statement.

if string.lower(stringChat) == "reset" then
    -- Code
elseif string.lower(stringChat) == "faster" then
    -- Code

{ I have an OCD when it comes to non-camelCase variables/custom functions. }
Report Abuse
DiabetiikZombie123 is not online. DiabetiikZombie123
Joined: 18 Jan 2011
Total Posts: 285
21 Jan 2012 07:27 PM
if i did the script like that what would i do with the ends?
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
21 Jan 2012 07:28 PM
Match the ends with the blue lines to the left.

† KMXD †
Report Abuse
DiabetiikZombie123 is not online. DiabetiikZombie123
Joined: 18 Jan 2011
Total Posts: 285
21 Jan 2012 07:29 PM
do i need to put any parentheses after the ends?
Report Abuse
Cyrok is not online. Cyrok
Joined: 11 Jan 2012
Total Posts: 630
21 Jan 2012 07:30 PM
What Knightmare said.

Or you could tab your code, which makes it look cleaner and more professional, and is also a good way to know how many ends you need.

{ I have an OCD when it comes to non-camelCase variables/custom functions. }
Report Abuse
DiabetiikZombie123 is not online. DiabetiikZombie123
Joined: 18 Jan 2011
Total Posts: 285
21 Jan 2012 07:33 PM
How is this?

local nameList = {
["DiabetiikZombie123"] = true;
["badboy123349"] = true;
["breckin12"] = true
}

-- Edit the table above to suit your needs

game:GetService("Players").PlayerAdded:connect(function(playerObject)
if nameList[playerObject.Name] then
playerObject.Chatted:connect(function(stringChat)
if string.lower(stringChat) == "reset" then
playerObject.Character:BreakJoints()
elseif string.lower(stringChat) == "faster" then
playerObject.Character.Humanoid.WalkSpeed = 32
elseif string.lower(stringChat) == "jump" then
playerObject.Character.Humanoid.Jump = true
elseif string.lower(stringChat) == "sit" then
playerObject.Character.Humanoid.Sit = true
elseif string.lower(stringChat) == "naked" then
playerObject.Character.Shirt:remove()
playerObject.Character.Pants:remove()
elseif string.lower(stringChat) == "slower" then
playerObject.Character.Humanoid.WalkSpeed = 16
end
end)
end
end)
Report Abuse
Cyrok is not online. Cyrok
Joined: 11 Jan 2012
Total Posts: 630
21 Jan 2012 07:35 PM
I just skimmed over it for a few seconds, looks good to me. But please try and tab your code if you're going to attempt to make this in a script.

{ I have an OCD when it comes to non-camelCase variables/custom functions. }
Report Abuse
DiabetiikZombie123 is not online. DiabetiikZombie123
Joined: 18 Jan 2011
Total Posts: 285
21 Jan 2012 07:37 PM
i dont know how to tab my code...........................
Report Abuse
Cyrok is not online. Cyrok
Joined: 11 Jan 2012
Total Posts: 630
21 Jan 2012 07:38 PM
You don't have to; it's just a good way to keep track of your ends and make it cleaner and easier to read.

{ I have an OCD when it comes to non-camelCase variables/custom functions. }
Report Abuse
DiabetiikZombie123 is not online. DiabetiikZombie123
Joined: 18 Jan 2011
Total Posts: 285
21 Jan 2012 07:40 PM
could you tell me how to tab my code?
Report Abuse
Cyrok is not online. Cyrok
Joined: 11 Jan 2012
Total Posts: 630
21 Jan 2012 07:46 PM
What you do is you push the tab key *after* each function, if/then, else, and do keyword. So for example:

    function checkNumbers()
        local a = 5 -- Tabbed after the 'function' keyword
        if a == 5 then
            local b = 10 -- Tabbed after the 'if/then' keywords
            if b == 10 then
                local c = "Hello World!"
                if c == "Hello World!" then
                    print("Correct!") -- Tabbed after the 'if/then' keywords
                else -- Get rid of a tab and go to the same margin as the if keyword that corresponds to this
                    print("Wrong.") -- Tabbed after the 'else' keyword
                end -- Get rid of a tab
            end -- Get rid of a tab
        end -- Get rid of a tab
    end -- Get rid of a tab

{ I have an OCD when it comes to non-camelCase variables/custom functions. }
Report Abuse
DiabetiikZombie123 is not online. DiabetiikZombie123
Joined: 18 Jan 2011
Total Posts: 285
21 Jan 2012 07:49 PM
ok cool now all im wondering is how i make it so i could say reset/name or guest or others or something like that any help there?
Report Abuse
Cyrok is not online. Cyrok
Joined: 11 Jan 2012
Total Posts: 630
21 Jan 2012 07:52 PM
Now that's where things get complicated.

I'm afraid I can't help you because that's not the point of this forum, to simply hand out scripts.

{ I have an OCD when it comes to non-camelCase variables/custom functions. }
Report Abuse
DiabetiikZombie123 is not online. DiabetiikZombie123
Joined: 18 Jan 2011
Total Posts: 285
21 Jan 2012 07:56 PM
im not requesting im just asking for a wiki or something that will work to help me with that.
Report Abuse
Cyrok is not online. Cyrok
Joined: 11 Jan 2012
Total Posts: 630
21 Jan 2012 08:01 PM
http://wiki.roblox.com/index.php/Function_Dump/String_Manipulation#string.sub_.28s.2C_i_.5B.2C_j.5D.29
http://wiki.roblox.com/index.php/Function_Dump/String_Manipulation#string.find_.28s.2C_pattern_.5B.2C_init_.3D_1_.5B.2C_plain_.3D_false.5D.5D.29

{ I have an OCD when it comes to non-camelCase variables/custom functions. }
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