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: How do I make this more efficient?

Previous Thread :: Next Thread 
Chronok is not online. Chronok
Joined: 29 Dec 2011
Total Posts: 402
02 Jan 2012 02:35 PM
    if tierOne[playerObject.Name] or tierTwo[playerObject.Name] or tierThree[playerObject.Name] then

This is part of my admin command script, but I don't find this to be efficient... at all. The tables I have aren't necessary, but if you want to see them, I'll post 'em for you.

{ ["Chronok"] = "Intermediate scripter/programmer." }
Report Abuse
smurf279 is not online. smurf279
Joined: 15 Mar 2010
Total Posts: 6871
02 Jan 2012 02:41 PM
Are you able to use logic operators(ternary blab whatever you call it). What you posted isn't ineffecient but you can't really say much only looking at one line of code
Report Abuse
Chronok is not online. Chronok
Joined: 29 Dec 2011
Total Posts: 402
02 Jan 2012 02:46 PM
    local tierOne = {
        ["nameOne"] = true;
        ["nameTwo"] = true;
        ["nameThree"] = true
    }
    
    local tierTwo = {
        ["nameOne"] = true;
        ["nameTwo"] = true;
        ["nameThree"] = true
    }
    
    local tierThree = {
        ["nameOne"] = true;
        ["nameTwo"] = true;
        ["nameThree"] = true;
        ["Chronok"] = true
    }
    
    local playersService = game:GetService("Players")
    local workspaceService = game:GetService("Workspace")
    
    playersService.PlayerAdded:connect(function(playerObject)
        playerObject.Chatted:connect(function(stringMessage)
            if string.sub(stringMessage, 1, 5) == "kill/" then
                if tierOne[playerObject.Name] or tierTwo[playerObject.Name] or tierThree[playerObject.Name] then

{ ["Chronok"] = "Intermediate scripter/programmer." }
Report Abuse
smurf279 is not online. smurf279
Joined: 15 Mar 2010
Total Posts: 6871
02 Jan 2012 02:55 PM
It doesn't get much better than what you posted unless you wanted us to rescript your code which i dun think anyone wants to do
Report Abuse
smurf279 is not online. smurf279
Joined: 15 Mar 2010
Total Posts: 6871
02 Jan 2012 02:58 PM
Check if the player is an admin after the playeradded function
Report Abuse
Chronok is not online. Chronok
Joined: 29 Dec 2011
Total Posts: 402
02 Jan 2012 03:01 PM
@smurf

I can't do that because then all tiers would be allowed to use all of the commands.

{ ["Chronok"] = "Intermediate scripter/programmer." }
Report Abuse
Merlin11188 is not online. Merlin11188
Joined: 20 Dec 2007
Total Posts: 4158
02 Jan 2012 03:07 PM
That's as efficient as it needs to be.
Report Abuse
Chronok is not online. Chronok
Joined: 29 Dec 2011
Total Posts: 402
02 Jan 2012 03:10 PM
@Merlin

Oh. It just seemed sort of... repetitive.

{ ["Chronok"] = "Intermediate scripter/programmer." }
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