I keep getting Unable to cast Instance to int64 errors whenever I run this script and I don’t know how to go about fixing this.
local passId = 6390 game.Players.PlayerAdded:Connect(function(plr) if isAuthenticated(plr) then script.Parent.Parent:Destroy() end end) function isAuthenticated(player) return game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player, passId) end
The script is in a GUI where the user clicks to buy a gamepass.
Also, whenever you click the button, the prompt that appears no longer shows the image of the gamepass so how can I fix that too?
At the moment the error appears to come from line 10
Thank you
To RubenKan's suggestion...
local passId = 6390 game.Players.PlayerAdded:Connect(function(plr) if isAuthenticated(plr.UserId) then script.Parent.Parent:Destroy() end end) function isAuthenticated(player) return game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player, passId) end
An int64 is a number. A plr is an Instance.
It requests an int64, not an Instance. Cast = Changing from one datatype to another