Not sure why you’d need to type check P_Service, since game:GetService("Players") guarantees that it returns that service.
Can I see the code for checkSubscriptionStatus()?
I’m not sure either I just like how it’s like that and sure hold on.
local function checkSubscriptionStatus(player : Player, subscriptionId : string)
local success, response = pcall(function()
return MS_Service:GetUserSubscriptionStatusAsync(player, subscriptionId)
end)
if not success then
warn(`Error while checking if player has subscription: {response}`)
return
end
if response.IsSubscribed then
grantAward(player, subscriptionId)
else
revokeAwardIfGranted(player, subscriptionId)
end
end
Ok well there’s your problem.
I’m not sure how you understand tables and for loops, but as an example, here’s what a basic for loop would do with that table:
for i, v in pairs(Subscription_Ids) do
print(i) -- EXP-5607828639684755692
print(v) -- VIP
end
So in your case, you’d want to use the first variable in the for loop to get the ID of the subscription:
for id, _ in pairs(Subscription_Ids) do
checkSubscriptionStatus(plr, id)
end
I don’t really understand. I’m not some AI whisperer. It gives you code depending on what you’ve prompted it. But if you wanted the table to be a basic array, you can write it as:
local Table = {"EXP-5607828639684755692"}
and then for the for loop:
for _, id in pairs(Subscription_Ids) do
checkSubscriptionStatus(plr, id)
end