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: HRs Team

Previous Thread :: Next Thread 
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
22 Dec 2011 03:36 PM
This script is supposed to let people in the HRs to be in the "High Ranks" team. If they're not on the list, they are on the "Regular People".

HRs = {"KnightmareXD", "OtherHR"}
HRTeam = game.Teams:findFirstChild("High Ranks")
RegTeam = game.Teams:findFirstChild("Regular People")

function Entered(plyr)
if (plyr.Name == HRs) then
plyr.TeamColor = HRTeam.TeamColor
else
plyr.TeamColor = RegTeam.TeamColor
end
end

game.Players.ChildAdded:connect(Entered)
Report Abuse
Spectrumw is not online. Spectrumw
Joined: 04 Aug 2009
Total Posts: 13510
22 Dec 2011 03:39 PM
HRs = {KnightmareXD = true, OtherHR = true}
HRTeam = game.Teams:findFirstChild("High Ranks")
RegTeam = game.Teams:findFirstChild("Regular People")

function Entered(plyr)
  plyr.TeamColor = (Hrs[plyr.Name]) and HRTeam.TeamColor or RegTeam.TeamColor
end

game.Players.PlayerAdded:connect(Entered)

Maybe?
Report Abuse
nate890 is not online. nate890
Joined: 22 Nov 2008
Total Posts: 21686
22 Dec 2011 03:42 PM
    local HRs = {"KnightmareXD", "OtherHR"}
    HRTeam = game.Teams:findFirstChild("High Ranks")
    RegTeam = game.Teams:findFirstChild("Regular People")

    function makeTrue(table)
        for i,c in pairs(table) do
            table[c]=true
        end
    end

    makeTrue(HRs)

    game.Players.PlayerAdded:connect(function(plr)
        if HRs[plr.Name] then
            plr.TeamColor = HRTeam.TeamColor
        else
            plr.TeamColor = RegTeam.TeamColor
        end
    end)
­<'+1 Post. Ujelly?'>
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
22 Dec 2011 03:42 PM
Hm, it's still spawning me in the "High Ranks". What does the = true in a table mean?
Report Abuse
nate890 is not online. nate890
Joined: 22 Nov 2008
Total Posts: 21686
22 Dec 2011 03:43 PM
    local HRs = {"KnightmareXD", "OtherHR"}
    HRTeam = game.Teams:findFirstChild("High Ranks")
    RegTeam = game.Teams:findFirstChild("Regular People")

    function makeTrue(table)
        for i,c in pairs(table) do
            table[c]=true
        end
    end

    makeTrue(HRs)

    game.Players.PlayerAdded:connect(function(plr)
        plr.TeamColor=HRs[plr.Name] and HRTeam.TeamColor or plr.TeamColor = RegTeam.TeamColor
    end)

­<'+1 Post. Ujelly?'>
Report Abuse
nate890 is not online. nate890
Joined: 22 Nov 2008
Total Posts: 21686
22 Dec 2011 03:43 PM
@Spec, shouldn't it be local t={["blah"]=true,["blah2"]=true}) :o?

­<'+1 Post. Ujelly?'>
Report Abuse
Spectrumw is not online. Spectrumw
Joined: 04 Aug 2009
Total Posts: 13510
22 Dec 2011 03:47 PM
t = {Hello = "World!"}
print(t["Hello"])

>World!

Hmm...
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
22 Dec 2011 03:47 PM
@nate
Your first script works, but I wasn't spawned in the HRs spawn location. :/
Report Abuse
Spectrumw is not online. Spectrumw
Joined: 04 Aug 2009
Total Posts: 13510
22 Dec 2011 03:49 PM
Try this one, I made a typo;
HRs = {KnightmareXD = true, OtherHR = true}
HRTeam = game.Teams:findFirstChild("High Ranks")
RegTeam = game.Teams:findFirstChild("Regular People")

function Entered(plyr)
  plyr.TeamColor = (HRs[plyr.Name]) and HRTeam.TeamColor or RegTeam.TeamColor
  plyr.CharacterAdded:wait()
  plyr.Character:BreakJoints()
end

game.Players.PlayerAdded:connect(Entered)
Report Abuse
nate890 is not online. nate890
Joined: 22 Nov 2008
Total Posts: 21686
22 Dec 2011 03:49 PM
@Spectrumw
Never knew that worked :o.

@OP, Then that's a problem with your spawns.

­<'+1 Post. Ujelly?'>
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