Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Unable to cast instance to int64 error?

Asked by
Memotag 226 Moderation Voter
5 years ago
Edited 5 years ago

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.

0
because 6204 isnt a valid gamepass id/ int64 theking48989987 2147 — 5y
0
and use :Destroy() instead of :Remove(), and Connect instead of connect theking48989987 2147 — 5y
0
what is the point of setting an id variable, then setting the value of another variable to id? theking48989987 2147 — 5y
0
6204 is a valid gamepass ID - I have taken into account your other points though Memotag 226 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

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.

Ad

Answer this question