Why doesnt my code get past the if statment even tho its true

The problem is v.Id “does not equal” productId even tho it does

local Player = script.Parent.Parent.Parent.Parent
local MarketplaceService = game:GetService("MarketplaceService")
local StrengthProductsTab = {
	["999K"] = {Id = "2673052501", StrengthGain = 999000},
	["999M"] = {Id = "2673053150", StrengthGain = 999000000},
	["999B"] = {Id = "2673053392", StrengthGain = 999000000000},
	["999T"] = {Id = "2673053586", StrengthGain = 999000000000000},
	["999QD"] = {Id = "2673053789", StrengthGain = 999000000000000000},
}
for i, v in pairs(script.Parent:GetChildren()) do
	if v:FindFirstChildOfClass("TextButton") ~= nil and v.Name ~= "Double Strength" then
		v:FindFirstChildOfClass("TextButton").MouseButton1Click:Connect(function()
			MarketplaceService:PromptProductPurchase(Player, StrengthProductsTab[v.Name].Id)
		end)
	end
end

for i, v in pairs(StrengthProductsTab) do
	MarketplaceService.PromptProductPurchaseFinished:Connect(function(UserId, ProductId, IsPurchased)
		if ProductId == v.Id and UserId == Player.UserId and IsPurchased == true then
			print("bruh")
			Player.Extra_Values.RealStrength.Value = tonumber(Player.Extra_Values.RealStrength.Value + v.StrengthGain)
		end
	end)
end

image
it says 2673052501 ~= 2673052501 when it its the same number

Is the v.Id an intvalue? If so, you would have to refer It as v.Id.Value

ProductId == tonumber(v.Id)

You are comparing a string against a number, it needs to be a number to number comparison (or string to string).

Yeah figured it out when I was on a walk

Ty tho

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