I keep getting Unable to cast Instance to int64 errors whenever I run this script and I don’t know how to go about fixing this.
local passId = 6390
game.Players.PlayerAdded:Connect(function(plr)
if isAuthenticated(plr) then
script.Parent.Parent:Destroy()
end
end)
function isAuthenticated(player)
return game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player, passId)
end
The script is in a GUI where the user clicks to buy a gamepass.
Also, whenever you click the button, the prompt that appears no longer shows the image of the gamepass so how can I fix that too?
At the moment the error appears to come from line 10
Thank you

1 comment
You're supposed to use the UserId instead of the Player instance, that's why it's giving you that error.