I set up a remote event to handle purchases for my game because it makes me feel neater and I'm getting "unable to cast instance to int64" in the dev console the script causing this error is: and the error occurs on line 7 and line 23
local MPService = game:GetService("MarketplaceService")
local HttpService = game:GetService("HttpService")
local Webhook = "empty because one of the reasons im using a remote event is security"
local event = game.ReplicatedStorage.hey
event.OnServerEvent:Connect(function(player, assetId)
promptpurchase(player, assetId)
end)
function GetSales(assetId)
local data = HttpService:JSONDecode(HttpService:GetAsync("https://api.roblox.com/Marketplace/ProductInfo?assetId="..assetId))
local sales = data.Sales
return(sales)
end
function GetName(assetId)
local data = HttpService:JSONDecode(HttpService:GetAsync("https://api.roblox.com/Marketplace/ProductInfo?assetId="..assetId))
local name = data.Name
return(name)
end
function promptpurchase(player, assetId)
MPService:PromptPurchase(player, assetId)
MPService.PromptPurchaseFinished:connect(function(Player, assetID, isPurchased)
if isPurchased then
local HookData = {
['username'] = "shop",
['content'] = "Player: "..player.Name.."\nAsset Bought: "..assetId"
}
HookData = HttpService:JSONEncode(HookData)
HttpService:PostAsync(Webhook, HookData)
end
end)
end
I've literally tried every possible thing I could think of, but lua's a very confusing language to me sometimes with the errors I get.
anyone got any ideas?
edit: some of you asked for what i was inputting as params so here it is:
game.ReplicatedStorage.hey:FireServer(game.Players.LocalPlayer, 320412452)

4 comments
It's telling you which line is erroring?
It means that you've set a property to an instance when the property is an integer. I suggest reviewing your code and the values you're writing to your instances' properties. It would also help if you posted the line the error occurs on.
the error occurs on line 7 and line 23
It means that assetId is an Instance then, your event is maybe sending an IntValue or something rather than IntValue.Value? Either way at least you know the problem