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

How would you create a group rank only gui?

Hey,

I am creating a group rank only gui where only someone with this rank or higher in the group can get to the next page. The rank is Excellence. Rankid: 2

Here is the code:

local config = script.Parent.Configuration
local player = game.Players.LocalPlayer

RBXScriptSignal:Connect()
 if part.Parent and game:GetService('Players'):GetPlayerFromCharacter(part.Parent) and
	 player:GetRankInGroup(config.GroupId.Value) >= config.RankId.Value then
	script.Parent.Parent.Visible=false
	script.Parent.Parent.Active=false
	script.Parent.Parent.Parent.three.Visible=true
	script.Parent.Parent.Parent.three.Active=true
end

Screenshots: https://ibb.co/e9yJpo https://ibb.co/eqWraT

2 answers

part appears to be nil, at least in the context of the code you posted. Regardless, it's not necessary to try to get the player this way.

Since all GUI controlling code should be in a LocalScript, we can access the special property that's only available client-side, game.Players.LocalPlayer.

local LocalPlayer = game.Players.LocalPlayer

local GroupId = 1000

print(LocalPlayer:GetRankInGroup(GroupId))

Aside from that, your code should work, though I'd encourage you to define variables for GUIs in your code, rather than referencing script.Parent chains so often.

Also, you should switch to RBXScriptSignal:Connect(), with a capital C, since the lowercase version is deprecated (meaning Roblox is telling you not to use it anymore).

3 comments

0

Couldn’t have said it better myself. +1 vote.

0

Though I’d recommend switching game.Players to game:GetService("Players")

0

Still not working, I've shown the new script in the original post.

Don't get mad at me if something is spelled incorrectly in the code, I'm just typing it in the site.

`` NOTE: THIS IS ONLY FOR THE GUI SHOWING. CONFIGURE AS NEEDED.

`` ALSO: THIS IS DESIGNED FOR A GUI ORIGINATING FROM THE StarterGui SERVICE.


------------------------------------------
--------------{Variables}-----------------
------------------------------------------
local GroupId = 000 -- type in the group's Roblox Id
local enabled = script.Parent.Enabled

-----------------------------------------
-----------------{Code}------------------
-----------------------------------------
if script.Parent.Parent.Parent.Parent.Parent:GetRankInGroup(GroupId) >= 2 then
	enabled = true
	-- The rest of your code (If this isn't all that you needed)
end

4 comments

0

I'm getting an GetrankInGroup is not a valid member of ScreenGui error

0

sorry. again, I typed this in the Scripting Helpers site, and, as predicted, it had some form of error.

0

I fixed the capitalization error as well as fixed the error where it said that it was not a valid member of ScreenGui. It was supposed to be from a GUI originating in StarterGui. By that I meant DIRECTLY the child of the ScreenGui.

0

@CallKnuss you have to capitalize rank in getrankingroup

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