Can someone explain why the error is occurring in my script?
local players = game:GetService("Players")
local keyValue = game:GetService("DataStoreService"):GetDataStore("Data")
local marketPlace = game:GetService("MarketplaceService")
local getShirt = function(playerGirl)
local InventoryUrl = "https://robloxdevforumproxy.glitch.me/users/inventory/list-json?assetTypeId=11&cursor=&itemsPerPage=100&pageNumber=%x&sortOrder=Desc&userId=%i"
local HttpService = game:GetService("HttpService")
local pageNumber = 0
local Inventory = 0
local updateInventory = function()
Inventory = HttpService:JSONDecode(HttpService:GetAsync(string.format(InventoryUrl, pageNumber, playerGirl.UserId))).Data
end
local idsOfStuff = {}
local checkInv = function()
pageNumber += 1
updateInventory()
local alreadyClaimed = false
for index, item in next, Inventory.Items do
if tonumber(item.Creator.Id) == 11352987 then
for _, w in next, idsOfStuff do
if w == item.Item.AbsoluteUrl then
alreadyClaimed = true
end
end
if alreadyClaimed == false then
table.insert(idsOfStuff, item.Item.AbsoluteUrl)
end
if alreadyClaimed == true then
alreadyClaimed = false
end
end
end
end
for i=1, 10 do
checkInv()
end
return table.getn(idsOfStuff)
end
local getRank = function(shirtsBought, playerGuy)
if shirtsBought == 0 then
return "Supporter"
elseif shirtsBought >= 3 then
if shirtsBought >=5 then
if shirtsBought >= 8 then
if shirtsBought >= 11 then
if shirtsBought >= 15 then
if shirtsBought >= 20 then
if shirtsBought >= 25 then
if shirtsBought >= 30 then
if shirtsBought >= 40 then
local groupInfo = game:GetService("GroupService"):GetGroupInfoAsync(11352987)
if playerGuy:GetRankInGroup(11352987) ~= (240 or 241) then
return "CUSTOM RANK"
end
return groupInfo[playerGuy:GetRankInGroup(11352987)]
end
return "Insane Buyer"
end
return "Nike Obsession"
end
return "Demonic"
end
return "Legend"
end
return "Elite"
end
return "Superstar"
end
return "Pro"
end
return "Rookie"
end
end
--[[
π±ππ’ πΉ+ ππππππ = ππππππ
π±ππ’ π»+ ππππππ = πΏππ
π±ππ’ πΎ+ ππππππ = πππππππππ
π±ππ’ π·π·+ ππππππ = π΄ππππ
π±ππ’ π·π»+ ππππππ = π»πππππ
π±ππ’ πΈπΆ+ ππππππ = π³ππππππ
π±ππ’ πΈπ»+ ππππππ = Nike Obsession
π±ππ’ πΉπΆ+ ππππππ = πΈπππππ π±ππ’ππ
π±ππ’ πΊπΆ+ ππππππ = πΏπππππππ ππππ
]]--
local doneLoading = true
players.PlayerAdded:Connect(function(player)
repeat wait(1) until doneLoading == true
doneLoading = true
local leaderstats = Instance.new("Folder")
leaderstats.Parent = player
leaderstats.Name = "leaderstats"
local shirts = Instance.new("IntValue")
shirts.Name = "Purchased"
shirts.Parent = leaderstats
shirts.Value = getShirt(player)
local ranking = Instance.new("StringValue")
ranking.Name = "Rank"
ranking.Parent = leaderstats
print(getRank(shirts.Value, player))
ranking.Value = getRank(shirts.Value, player) -- LINE 101 ERROR LINE!!
doneLoading = false
end)
SCRIPT ABOVE ERROR BELOW
19:36:49.266 ServerScriptService.Script:101: invalid argument #3 (string expected, got nil) - Server - Script:101