Group rank only visible brick

I am trying to make a cruise pad for an airline where staff with a role id higher than or equal to 10 will be able to see the cruise pad.

What I did is created a LocalScript located in StarterPlayerScripts looking like this.
Screenshot 2565-07-07 at 02.04.17

game.Players.PlayerAdded:Connect(function(newPlayer)
	local rank = newPlayer:GetRankInGroup(12646662) 
	if rank >= 10 then
		warn("User is staff, cruise pad visible.")
	elseif rank < 10 then
		for i,v in pairs(workspace.Cruise_Pad:GetChildren()) do
			v.Transparency = 1
		end
	end
end)

In Workspace, there is a Model called Cruise_Pad and there are parts inside the Model.
Screenshot 2565-07-07 at 02.05.02

I used GetChildren to locate all the parts in the Model and change its transparency to 1 for regular members (those with role id lower than 10)

The issue that I am experiencing is that the script isn’t functioning as expected, if you know the solution to this it would be highly appreciated.

1 Like

You should change it locally and check it locally. This will not work on the server as if a staff joins, everyone will see and if someone else joins, no staff or anyone will see.
edit: you can check if they are the appropriate rank to see it, and then change it on the client.

1 Like

The PlayerAdded event only fires when a player joins the game. Since it’s on a local script, the local script starts running after the player joins the game, and so the PlayerAdded event doesn’t fire.

You can instead use game.Players.LocalPlayer

local player=game.Players.LocalPlayer --Since it's a local script you can get the player this way
local rank = player:GetRankInGroup(12646662) 
if rank >= 10 then
	warn("User is staff, cruise pad visible.")
elseif rank < 10 then
	for i,v in pairs(workspace.Cruise_Pad:GetChildren()) do
		v.Transparency = 1
	end
end
5 Likes