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