Roblox "Handles" won't update visibility depending on group rank

I want to make the “Handles” in my game visible and invisible depending on your rank in the roblox group. This should be player sided and the localscript doesn’t change the visibility for all players that join.

The current localscript I tried so far does not work whatsoever, I pasted it under the handles itself, which I plan to put in ReplicatedStorage, which I’m not allowed to change. Also another issue I’m facing is that despite the “Handles” being in ReplicatedStorage, they are still somehow visible upon joining.

I’ve already tried searching for solutions on the forum, and asking ChatGPT to try and make changes to fix it, but no effect was made.

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

local player = game.Players.LocalPlayer
local groupid = 14664007
local minrank = 244

if player:GetRankInGroup(groupid) >= minrank then
	script.Parent.Visible = true
else
	script.Parent.Visible = false
end

Can you elaborate on what the “Handles” are?

777313b8ca2c876913992dc5215eb3e457bec534

Print player:GetRankInGroup(groupid) and see what’s returned. I also recommend you make a server script, check for the player’s group rank, and then copy the “Handle” to the player’s PlayerGui instead. This will prevent exploiters from getting ahold of this “Handle.”

A “handle” isnt something that can be used to modify anything ingame, it’s just a visual indicator, so it doesn’t really need to be protected from exploiters.

What should I add to the serverscript to fix the main issue, though?

Did you print player:GetRankInGroup(groupid)?

Tbh I don’t know what you’re asking me to do, I’m very basic at scripting

local player = game.Players.LocalPlayer
local groupid = 14664007
local minrank = 244

print(player:GetRankInGroup(groupid)

if player:GetRankInGroup(groupid) >= minrank then
	script.Parent.Visible = true
else
	script.Parent.Visible = false
end

Put this in the script and run the game.

1 Like

Perhaps using the GroupService would be more reliable for this?

local GroupService = game:GetService("GroupService")

local PlayerIsInGroup = function()
	local Success, Groups = pcall(GroupService.GetGroupsAsync, GroupService, Player.UserId)
	if not Success or #Groups == 0 then
		return false, 0
	end
	local IsInGroup = false
	local GroupRank = 0
	for _, Group in ipairs(Groups) do
		if Group.Id == GROUP_ID then
			IsInGroup = true
			GroupRank = Group.Rank
			break
		end
	end
	return IsInGroup
end

...

local IsInGroup, GroupRank = PlayerIsInGroup()
if IsInGroup and GroupRank >= MINIMUM_RANK then
	Frame.Visible = true
else
	Frame.Visible = false
end

GroupService | Documentation - Roblox Creator Hub

Didn’t work, does scripts run differently in studio compared to roblox or something?

Nothing got printed out, idk what else to do

Do you have the output open?

I checked Client and Server Output, it didn’t print any GroupID

The output will give you errors and display printed info during runtime. Using it is very useful for debugging. To open it, go from the Topbar → Script → Output. A bar that says “Output” will then be opened.


Honestly, I would just recommend you learning the basics of scripting first, with tutorials from people such as TheDevKing, so that you could be able to fix some of these rather simple problems on your own.

2 Likes

Some advice: Don’t try programming if you can’t do something as simple as printing a number.
Watch a lot of tutorials before attempting anything with programming.

Here’s things for you to consider:

  1. Is the script enabled?
  2. Is the script even running? (If not, put it under StarterCharacterScripts)
  3. Is the script type correct? Your code requires a LocalScript

This seems like the issue here. “What should I add to the serverscript to fix the main issue though?”

No, it’s definitely a localscript, I didn’t attempt to make a serverscript yet.

Why did you call it one then? And have you figured out how to open the output?