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

How would you create a group rank only gui?

Asked by 5 years ago
Edited 5 years ago

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

Log in to vote
1
Answered by
Avigant 2374 Moderation Voter Community Moderator
5 years ago

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).

0
Couldn’t have said it better myself. +1 vote. User#19524 175 — 5y
0
Though I’d recommend switching game.Players to game:GetService("Players") User#19524 175 — 5y
0
Still not working, I've shown the new script in the original post. CallKnuss 5 — 5y
Ad
Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

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
0
I'm getting an GetrankInGroup is not a valid member of ScreenGui error CallKnuss 5 — 5y
0
sorry. again, I typed this in the Scripting Helpers site, and, as predicted, it had some form of error. GamingZacharyC 152 — 5y
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. GamingZacharyC 152 — 5y
0
@CallKnuss you have to capitalize rank in getrankingroup bblossomedd 2 — 2y

Answer this question