I’m attempting to make a “handle” visible to only certain people above a rank in a group and need help with the script I’ve currently got. There is no output when testing with print(“test”)
This is how it’s laid out in Workspace:
This is the script:
local player = game.Players.LocalPlayer
local groupid = 9188784
local minrank = 242
if player:GetRankInGroup(groupid) >= minrank then
print("test")
script.Parent.Visible = true
print("test")
else
print("test")
script.Parent.Visible = false
print("test")
end
Tried your same code and it works fine for me. Is there anything else before that piece of code? And are you getting any errors? Also, your issue might be related to Roblox being slow at the moment.
Nothing else before the code listed and no errors that I can see. Hadn’t thought about Roblox being slow as the cause, will test it again in a couple hours once everything should be back to normal.
You should probably clone the tool from ReplicatedStorage IF the user is above the rank. That way, it would be easier and more configurable for your future needs.
Oh, I see, well then you won’t be needing to do what I just said earlier. Just have a function that returns true or false if the player’s rank requirement is met. Then you can use that bool value to make the dot visible to that certain people.
I’ve got it working, though at this point I’ve realized because it’s in Workspace all that’s happening is the part will become visible (or vice versa) for everyone each time a player joins, defeating the purpose of what I’m trying to do.
ServerScript:
local GID = script.GroupID.Value
local GR = script.GroupRank.Value
local cruise = game.Workspace.cruise
local Players = game:GetService("Players")
Players.PlayerAdded:Connect(function(player)
if player:IsInGroup(GID) and player:GetRankInGroup(GID) >= GR then
game.Workspace.Radar1.Handles.Visible = true
game.Workspace.Radar2.Handles.Visible = true
else
game.Workspace.Radar1.Handles.Visible = false
game.Workspace.Radar2.Handles.Visible = false
end
end)
I’ve become very familiar with RemoteEvents and client-side scripts in the past few days and know that the solution will have something to do with that,
Are you trying to make the handle only visible to a single client / player? Then you can just clone the handle into the player’s PlayerGui so it only renders for them.
If you want it to be visible to everyone with that rank, then you will need to have it invisible before putting it into workspace. Those with the rank will need to make it visible from their localscript.