I am struggling with a issue at the moment. I have a GUI on a part and I am trying to make it so only the frame that allows you to control it is visible to people above a certain rank. It is supposed to change from the "Disabled" gui to "ShutterController" gui but it isn't working. May somebody be able to help me solve this issue I am having. The code is below. Just so you know the lowestViewRank will be set higher and I am in the group and above that rank number but the GUI is not changing.
local groupId = 5002973 local groupService = game:GetService("GroupService") local lowestViewRank = 1 local HighestViewRank = 255 if game.Players.LocalPlayer:GetRankInGroup(lowestViewRank) < HighestViewRank then script.Parent:FindFirstChild("Disabled").Visible = false script.Parent:FindFirstChild("ShutterController").Visible = true end
lowestViewRank isn't the group you are checking, it's the rank.
The
GetRankInGroup()
Function requires the group id as the parameter, NOT the lowest rank. It returns that player's rank in that specific group.
So, you would do:
if game.Players.LocalPlayer:GetRankInGroup(groupId) >= lowestViewRank and game.Players.LocalPlayer:GetRankInGroup(groupId) <= HighestViewRank then script.Parent:WaitForChild("Disabled").Visible = false script.Parent:WaitForChild("ShutterController").Visible = true end
It has not seemed to have of worked the code is below so you can see if I wrote it correct, the Local Script is in the surfacegui and I dont know what is causing it to stop it from changing.
local groupId = 5002973 local groupService = game:GetService("GroupService") local lowestViewRank = 1 local HighestViewRank = 255 if game.Players.LocalPlayer:GetRankInGroup(groupId) >= lowestViewRank and game.Players.LocalPlayer:GetRankInGroup(groupId) <= HighestViewRank then script.Parent:FindFirstChild("Disabled").Visible = false script.Parent:FindFirstChild("ShutterController").Visible = true end
Try this script: Also make sure this is in a local script inserted in startergui If that doesn't work use a remote event
game.Players.PlayerAdded:Connect(function(Player) if Player:GetRankInGroup(5002973) >= 1 and Player:GetRankInGroup <= 255 then script.Parent:FindFirstChild("Disabled").Visible = false script.Parent:FindFirstChild("ShutterController").Visible = true print("Player is the owner of the group, 'LOL'!") else print("Player is NOT the owner of the group, 'LOL'!") end end)