Hi devs, i have maid a script who normally give a rank on a group when a player buy the gamepass BUT it not working and i want to know if Roblox allow that , like bcs its look like its not possible to do that. Someone can help me ?
Here is the script bdw :
local GroupId = 14398889
local GamePassId = 157484528
local RankNumber = 251
local MarketplaceService = game:GetService("MarketplaceService")
local GroupService = game:GetService("GroupService")
local function updateRank(player)
local ownsGamePass = MarketplaceService:UserOwnsGamePassAsync(player.UserId, GamePassId)
if ownsGamePass then
print(player.Name .. " owns the gamepass TESTER")
local rankObject = GroupService:GetRankInGroup(GroupId, player.UserId)
if rankObject then
rankObject:SetRank(RankNumber)
print(player.Name .. " rank has been set to " .. RankNumber)
else
warn("Failed to change group rank for player " .. player.Name .. ": player is not in the group")
end
else
print(player.Name .. " does not own the gamepass TESTER")
end
end
game.Players.PlayerAdded:Connect(function(player)
updateRank(player)
end)
for _, player in ipairs(game.Players:GetPlayers()) do
updateRank(player)
end
and i think this local rankObject = GroupService:GetRankInGroup(GroupId, player.UserId) line and this rankObject:SetRank(RankNumber) line should be change to local rankObject = player:GetRankInGroup(GroupId) and GroupService:SetRank(RankNumber)
I’m not here to help with scripting but just to let you know, my almost-three-year-old response is not correct.
A singular Google search can give you:
To put it short, do not sell group ranks as gamepasses. It’s unethical, and against Roblox’s rules.
It’s more worth it to make a good game, than making incredibly overpriced group rank gamepasses to make money as you could get in trouble.