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: Team for a certain group rank

Previous Thread :: Next Thread 
Blockkiller001 is not online. Blockkiller001
Joined: 25 Jan 2011
Total Posts: 272
16 Nov 2014 08:54 AM
Hey, I'm looking for a script that only allows people of a certain rank and above in a group join the server.

Currently I have this script to let people in a specific group join a team:

function onButtonClicked()
if script.Parent.Parent.Parent.Parent.Parent:IsInGroup(1234) then
script.Parent.Parent.Parent.Parent.Parent.TeamColor = BrickColor.new("Really black")
script.Parent.Parent.Parent.Parent.Parent.Character.Humanoid.Health = 0
end
end

script.Parent.MouseButton1Click:connect(onButtonClicked)


I was wondering how to modify this, presumably the second line, that would mean only a person of a certain rank and above (e.g. people who have the rank value 150 or higher) can join the team.

Thanks in advance!
Report Abuse
ChunkyEpicSword123 is not online. ChunkyEpicSword123
Joined: 27 Aug 2012
Total Posts: 81
16 Nov 2014 09:00 AM
In this line:
if script.Parent.Parent.Parent.Parent.Parent:IsInGroup(1234) then
is 1234 a URL? If so, then try httpservice.
Report Abuse
eLunate is not online. eLunate
Joined: 29 Jul 2014
Total Posts: 13268
16 Nov 2014 09:01 AM
Replace 1234 with the ID for your group.
Report Abuse
Blockkiller001 is not online. Blockkiller001
Joined: 25 Jan 2011
Total Posts: 272
16 Nov 2014 09:13 AM
1234 is just an example of the group ID.

So, for example, if it was the 'Roblox' group, the value inside the brackets would be 7.
Report Abuse
devSurface is not online. devSurface
Joined: 09 Feb 2013
Total Posts: 1339
16 Nov 2014 09:16 AM
script.Parent.MouseButton1Down:connect(function()
if game.Players.LocalPlayer:IsInGroup(000000) then
game.Players.LocalPlayer.TeamColor = BrickColor.new("Really black")
game.Players.LocalPlayer.Character.Humanoid.Health = 0
end

end)
Report Abuse
Blockkiller001 is not online. Blockkiller001
Joined: 25 Jan 2011
Total Posts: 272
16 Nov 2014 09:30 AM
Just had a quick look around on the wiki, and wondered if this modified script would work:

game.Players.PlayerAdded:connect(function(Player)
if Player:GetRankInGroup(1234) >= 50 then
TeamColor = BrickColor.new("Really black")
Character.Humanoid.Health = 0
end
end)

That script probably won't work, but something similar to that nonetheless. That one changes the team as soon as they join, which might be more favorable over a GUI.

Modifying my original script, this one seems more likely to work (plus its based off the GUI):

function onButtonClicked()
if script.Parent.Parent.Parent.Parent.Parent:GetRankInGroup(1234) >= 50 then
script.Parent.Parent.Parent.Parent.Parent.TeamColor = BrickColor.new("Really black")
script.Parent.Parent.Parent.Parent.Parent.Character.Humanoid.Health = 0
end
end

script.Parent.MouseButton1Click:connect(onButtonClicked)

Would the second one work?
And how would you modify the first script to make it work?

Having a script that automatically assigns someone to a team would be good, since then I wouldn't need a GUI.

Report Abuse
Blockkiller001 is not online. Blockkiller001
Joined: 25 Jan 2011
Total Posts: 272
16 Nov 2014 10:11 AM
FORGET EVERYTHING!

I made a script that seems to be much more efficient, and removes the need for teamchange GUI's:

game.Players.PlayerAdded:connect(function(newPlayer) --When a new player joins
if game.Players.LocalPlayer:GetRankInGroup(1199066) >= 50 then --Checks for High ranks first
game.Players.LocalPlayer.TeamColor = BrickColor.new("Really black") --Change player's team colour to Really Black
elseif newPlayer:IsInGroup(1199066) then --If player is in group
newPlayer.TeamColor = BrickColor.new("Dark stone grey") --Change player's team colour to Dark stone grey
end
end)

Seems to work when testing in Studio, tell me what you guys think!
Report Abuse
devSurface is not online. devSurface
Joined: 09 Feb 2013
Total Posts: 1339
16 Nov 2014 10:13 AM
How could you test this in studio? btwthis isnt that efficient thou.
Report Abuse
Blockkiller001 is not online. Blockkiller001
Joined: 25 Jan 2011
Total Posts: 272
16 Nov 2014 10:26 AM
I just use 'Play Solo' whilst signed in so it recognises what groups I'm in.

Seems to work, testing it by joining the actual place now.
Report Abuse
Blockkiller001 is not online. Blockkiller001
Joined: 25 Jan 2011
Total Posts: 272
16 Nov 2014 10:31 AM
Nevermind, the join script doesn't seem to work.

Back to GUIs it is then.

I've managed to get the scripts working, thanks to everyone who helped! If you have a more efficient version, feel free to post it!
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