Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

error: arithmetic (add) on string and number??

line 19 attempt to perform arithmetic (add) on string and number, why is this happenening??? it should work right

local CD = script.Parent.ClickDetector
local MS = game:GetService("MarketplaceService")
local players = game:GetService("Players")

local assetid = script.Parent.Parent.Parent.ClotheInfo.ShirtBuyID.Value

CD.MouseClick:Connect(function(plr)
	MS:PromptPurchase(plr, assetid)
end)

MS.PromptPurchaseFinished:Connect(function(player, assetId, isPurchased)
	if assetId == assetid then
		if isPurchased then
			local owner = game.Players:FindFirstChild(script.Parent.Parent.Parent.Parent.Parent.Owner.Value.Name)
			
			print("giving")
			
			local money = owner.leaderstats.Cash
			money.Value = money.Value + 100
		end
	end
end)

1 comment

0

What kind of value is Owner? (ie. bool, int, string)

1 answer

Make sure that money isn't a StringValue. If you wish to keep it as a StringValue, then use the tonumber() function on money.Value.

This discussion is preserved as it was. New answers, comments, and votes are closed.