I have a part, if you touch it and own the gamepass, you will get moved to a location. If you don't own it, you will be prompted the gamepass "buy screen". But I get this error:
Unable to cast Instance to int64
This is the script:
GamePassService = game:GetService('MarketplaceService')
toolGamePass = 2068240
script.Parent.Touched:Connect(function(hit)
player = game.Players:GetPlayerFromCharacter(hit.Parent)
if GamePassService:UserOwnsGamePassAsync(player,toolGamePass) then
hit.Parent:MoveTo(Vector3.new(0,100,0))
else
GamePassService:PromptGamePassPurchase(player.PlayerId, toolGamePass)
end
end)

3 comments
replace 'player.PlayerId' with 'player.UserId'
Thanks!
Typo :/