Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Unable to cast instance to int64 error?

Hi, I keep getting an error as shown in the title whenever I show a GUI with this script in it to the player. How can I fix this?? Thank you

   id = 6204

local passId = id

function isAuthenticated(player)

return game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player, passId)

end

game.Players.PlayerAdded:connect(function(plr)

if isAuthenticated(plr) then

script.Parent.Parent:remove()

end

end)

The script is supposed to show a GUI where the user can click on it to buy a gamepass if they so wish.

4 comments

0

because 6204 isnt a valid gamepass id/ int64

0

and use :Destroy() instead of :Remove(), and Connect instead of connect

0

what is the point of setting an id variable, then setting the value of another variable to id?

0

6204 is a valid gamepass ID - I have taken into account your other points though

1 answer

✓ Accepted answer

Lua is a hierarchy language. Your variables are not assigned correctly so the computer does not know what to cast to. Rearrange your variables so that the variables are executed first then the functions/events.

This discussion is preserved as it was. New answers, comments, and votes are closed.