|
| 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 |
|
|
|
| 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
|
  |
| Joined: 29 Jul 2014 |
| Total Posts: 13268 |
|
|
| 16 Nov 2014 09:01 AM |
| Replace 1234 with the ID for your group. |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 16 Nov 2014 10:13 AM |
| How could you test this in studio? btwthis isnt that efficient thou. |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|
|
| 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 |
|
|