Hello, Today I am wondering how I could make something like. Depending on what rank you are in a group depends what images/colors show up on your screen. I’m not sure how to get started or even do this please help
You can get the player’s rank id using :GetRankInGroup(), see more here: Player | Roblox Creator Documentation
Here’s a sample script to make it simpler for you:
game.Players.PlayerAdded:Connect(function(Player)
if Player:GetRankInGroup(GROUPIDHERE) == RANKIDHERE then
Player.PlayerGui.ScreenGui.Frame.BackgroundColor3 = Color3.new(1, 0, 0) --Red color
else
print("Player does not have required rank")
end
end)
game.Players.PlayerAdded:Connect(function(Player)
if Player:GetRankInGroup(11084770) == 241 then
Player.PlayerGui.ScreenGui.MainUi.BackGround.BackgroundColor3 = Color3.new(1, 0, 0) --Red color
else
print("Player does not have required rank")
end
end)
I doesn’t printout anything and I have the rank but its not changing the color to red
The server should not handle UI-related things, check their rank and use a :FireClient() function instead.
More information here: RemoteEvent | Roblox Creator Documentation
I made it as a local script though. Was I suppost to?
The PlayerAdded part will be server-sided, as well as the checking.
What’s needed for the client is to change the color of the BackGround
object
So make a serverscript and add a event correct?
NVM, reread ur reply 1111111111
game.Players.PlayerAdded:Connect(function(Player)
if Player:GetRankInGroup(11084770) == 241 then
Player:WaitForChild("PlayerGui").ScreenGui.MainUi.BackGround.BackgroundColor3 = Color3.new(1, 0, 0) --Red color
else
print("Player does not have required rank")
end
end)
try this
It’s able to handle to get the player’s gui by returning who ran the event, doesn’t it?
I still didn’t work. Thanks for the attempt though
Does it give you any errors in the output?
Try adding a print after
if Player:GetRankInGroup(11084770) == 241 then
print("Player has required rank")
I don’t understand what you mean here.
But if you meant that the PlayerAdded event returns the player instance, then yes it does.
That’s not what the problem is, the problem is that OP is modifying the PlayerGui’s descendants with a serverscript.
More information can be found here: Do I use a LocalScript or a Script for PlayerGUI? - #4 by fearFaerie
The server can access PlayerGui as long as it has the player’s instance, so this should not be the problem.
But the fact is that server scripts do have access to PlayerGui and it’s descendants.