This has already been answered
Hi everyone.
I'm relatively new to Lua, and have been experimenting with this piece of code:
local id = 000000 script.Parent.MouseButton1Click:Connect(function() -- Detects a mouse click if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserID, id) then print('Success') else game.Players.LocalPlayer.PlayerGui.Gamepass.Frame.Visible = true -- Sets the executing player's frame to visible end end)
In short, the code triggers once a text button is clicked and the aim is to check if the user has a gamepass or not (I've set the ID to '000000' for the example). If the user does have the gamepass, then it'll print "success", but if the user doesn't, it'll trigger a frame to open.
The particular line that I've been getting an error ("Unable to cast instance into int64") is line 4:
if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserID, id) then
I've been trying to troubleshoot this for some time now and have seen some people suggest adding .Value to the 'id' section.
Any thoughts?