Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I change this so you have to be a certain rank instead of just being in the group?

Asked by
NNevin 5
7 years ago

So I have this script and right now if you are even in the group you can become any rank if you click this gui.

I would like to be able to have it so you have to be in the group and a certain rank for example if you are rank number 14 and the name of the rank is millitary, you click the gui millitary button you can become that rank. But if you are rank 2 and click it nothing happens.

Here is the script I have I just need it configured for the ranks.

function Click(mouse) if script.Parent.Parent.Parent.Parent.Parent:IsInGroup(1138896) then --Replace '000000' with your Groups ID. script.Parent.Parent.Parent.Parent.Parent.TeamColor = BrickColor.new("Deep blue") --Change this to whatever Team Colour the DEFENDING Team is. Get Caps right. end end

script.Parent.MouseButton1Click:connect(Click)

0
You can use the :GetRankInGroup() and :GetRoleInGroup() functions of the Player object. Rank is a number, and Role is a name, so it's generally better to use rank as you don't have to worry about exact spelling. Also, with rank, you can use comparison operators to, for example, let anyone above a certain rank have something. GoldenPhysics 474 — 7y

1 answer

Log in to vote
0
Answered by 7 years ago
Edited 7 years ago

Haven't tested this script, but I think it should work.

function Click(mouse) 
    local Rank = script.Parent.Parent.Parent.Parent.Parent:GetRoleInGroup(1138896)  
    if Rank == 14 then 
        script.Parent.Parent.Parent.Parent.Parent.TeamColor = BrickColor.new("Deep blue")
    end
end

script.Parent.MouseButton1Click:connect(Click)
0
Thanks I will test it out soon NNevin 5 — 7y
0
Accidentally posted one of my old group's id in the script, replaced it with your group's id CoolJohnnyboy 121 — 7y
0
Isn't role the name and rank the number? FrostTaco 90 — 7y
Ad

Answer this question