Unable to cast value to Object

I’ve been getting an error when trying to pull a gamepass ID out of a table, and it keeps throwing the error unable to cast value to object. Ive printed the ID and it gives me back 1.

			["Team Description"] = "Keep watch in the fire tower for bushfires!",
			["Team"] = teamsService["Snowkins State Park Fire & Rescue"],
			["Type"] = "Gamepass",
			["ID"] = 1,
									local id = teamTable["ID"]
									if marketPlaceService:UserOwnsGamePassAsync(localPlayer.UserId, tonumber(teamTable["ID"])) then
										setTeam(teamsService[textButton.Name])
									else
										marketPlaceService:PromptGamePassPurchase(localPlayer.UserId, tonumber(teamTable["ID"]))
										marketPlaceService.PromptGamePassPurchaseFinished:Connect(function(localPlayer, ID, complete)
											if complete then
												setTeam(teamsService[textButton.Name])
											end
										end)
									end

image

Solved. I was being an idiot and read the error wrong.

1 Like

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