I’m trying to make a rainbow rank gamepass but also make it so certain ranks in a group can as well and there is an error involved and I don’t know what it means?
local Utility = script:WaitForChild(“Utility”)
local DataStore2 = require(Utility:WaitForChild(“DataStore2”))
local DataStoreService = game:GetService(“DataStoreService”)
local ServerDataStore = DataStoreService:GetDataStore(“SDDred1r2”)
local cache ={}function GetID(username)
local userID;
if cache[username] then return true, cache[username] end
local s, e = pcall(function()
userID = game.Players:GetUserIdFromNameAsync(username)
end)
if s then
cache[username] = userID
end
return s, userID
endfunction GetGroupsAsync(Player)
local UserId = (typeof(Player) == “Instance” and Player:IsA(“Player”)) and Player.UserId or typeof(Player) == “number” and Player
local Success, Groups = pcall(game:GetService(“GroupService”).GetGroupsAsync, game:GetService(“GroupService”), UserId)
return Success and Groups or { }
endfunction GetRoleInGroupAsync(Player)
local Groups = GetGroupsAsync(Player)
for Index = 1, #Groups do
local Group = Groups[Index]
if Group.Id == 6201590 then
return Group.Role
end
end
return “Guest”
endfunction GetRankInGroupAsync(Player)
local Groups = GetGroupsAsync(Player)
for Index = 1, #Groups do
local Group = Groups[Index]
if Group.Id == 6201590 then
return Group.Rank
end
end
return 0
endgame.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(char)
repeat wait() until char
local head = char:WaitForChild(“Head”)
local rank = Utility:WaitForChild(“Rank”):Clone()
rank.Parent = head
rank:WaitForChild(“Frame”):WaitForChild(“Name1”).Text = player.Name
rank:WaitForChild(“Frame”):WaitForChild(“TextLabel”).Text = GetRoleInGroupAsync(player)
if game:GetService(“MarketplaceService”):UserOwnsGamePassAsync(player.UserId, 12766781) or GetRankInGroupAsync(player) >= 180 then
coroutine.wrap(function()
while true do
for i=1, 360 do
rank:WaitForChild(“Frame”):WaitForChild(“Name1”).TextColor3 = Color3.fromHSV(i/360, 1, 1)
wait()
end
end
end)()
end
end)
end)