I am trying to get this script to tell if the player owns a gamepass, but it is not working.
local passId = 9179702
function isAuthenticated(player)
return game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player, passId)
end
function check()
local victimplr = script.Parent.Parent.Parent.Parent.Parent
local victim = script.Parent.Parent.Parent.Parent.Parent.Character
if isAuthenticated(victimplr) then
-- Do stuff
else
game:GetService("MarketplaceService"):PromptGamePassPurchase(victimplr, passId)
end
end
script.Parent.MouseButton1Down:connect(check)
Error message
17:42:21.627 - Unable to cast Instance to int64
17:42:21.628 - Stack Begin
17:42:21.629 - Script 'Players.DozWorl.PlayerGui.CharacterCreatorNaruto.Hair1.Adult Sasuke.Hair2', Line 6 - function isAuthenticated
17:42:21.630 - Script 'Players.DozWorl.PlayerGui.CharacterCreatorNaruto.Hair1.Adult Sasuke.Hair2', Line 16 - function kill
17:42:21.630 - Stack End