Unable to cast Array to int64

I’m working with for loops in arrays and i’m getting this error:

Unable to cast Array to int64  -  Server - gamepasses:20

this is my code:

local MarketPlaceService = game:GetService("MarketplaceService")

function values(t)
	local i = 0
	return function() i = i + 1; return t[i] end
end

local items = {
	{26875613, {script.Bomb5}},
	{26876499, {script.RPG5}},
	{26875573, {script.Bomb5, script.RPG5}},
}

for item in values(items) do
	local gamepassId = items[1]
	local tools = items[2]
	game.Players.PlayerAdded:Connect(function(plr)
		plr.CharacterAdded:Wait()
		if MarketPlaceService:UserOwnsGamePassAsync(plr.UserId, gamepassId) then
			for tool in values(tools) do
				local ToolClone = tool:Clone()
				ToolClone.Parent = plr.Backpack
			end
			
		end
	end)
end

you are casting an array of the gamepassid and the script.Bomb5 to markplaceservice, try changing items to item

1 Like

you’re right my bad thank you!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.