Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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)

2 comments

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.

1 answer

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)

3 comments

0

Thanks I will test it out soon

0

Accidentally posted one of my old group's id in the script, replaced it with your group's id

0

Isn't role the name and rank the number?

This discussion is preserved as it was. New answers, comments, and votes are closed.