Simple idea, I need to fix this script to disable a GUI when a member’s rank is lower than a certain integer between 0 and 255. Here’s the code:
local Player = game.Players.LocalPlayer
local Billboard = script.Parent
game.Players.PlayerAdded:Connect(function()
if Player:GetRankInGroup(14995254) <= 100 then
Billboard.Enabled = false
else
Billboard.Enabled = true
end
end)
If this is a LocalScript, you won’t need the PlayerAdded part since it only needs to run once at the beginning of the game or each time the player spawns if the ScreenGui is set to ResetOnSpawn.
local Player = game.Players.LocalPlayer
local Billboard = script.Parent
if Player:GetRankInGroup(14995254) <= 100 then
Billboard.Enabled = false
else
Billboard.Enabled = true
end
Since it’s local judging by the LocalPlayer, you do not need the PlayerAdded event as it’s created after the player has been made, so it will never run.
Simplest way of doing what you want
local Player = game.Players.LocalPlayer
local Billboard = script.Parent
Billboard.Enabled = Player:GetRankInGroup(14995254) > 100
Though as a recommendation, I don’t recommend this as the rank check can be bypassed easily by exploiters changing the Enabled setting manually.
If you want to ensure only players with a specific rank can use the billboard, check the Rank from the server and then clone the Billboard to the player instead so low ranks wont have the billboard sitting disabled (Make sure you put the billboard in ServerStorage so exploiters can’t clone it to themselves
local Player = game.Players.LocalPlayer
local Billboard = script.Parent
game.Players.PlayerAdded:Connect(function(player)
local success,result = pcall(function()
return player:GetRankInGroup(14995254)
end)
if success then
if result <= 100 then
Billboard.Enabled = false
else
Billboard.Enabled = true
end
end
end)