My script gives me cash but for some reason it wont let me spend it in game to buy droppers!

local ting = 0

function onTouched(hit)
	if ting == 0 then 
	ting = 1
	check = hit.Parent:FindFirstChild("Humanoid")
	if check ~= nil then 

		local user = game.Players:GetPlayerFromCharacter(hit.Parent)
		local stats = user:findFirstChild("leaderstats")

		if stats ~= nil then 
			local cash = stats:findFirstChild("Cash")
			cash.Value  = cash.Value  +500 
		wait(5)
		end 
	end 
	ting = 0
	end 

end 

script.Parent.Touched:connect(onTouched)

This is the script in my button, I can buy it and it gives me the cash, but for some reason I can't spend the cash :/

local productId = 36415601  
local player = game.Players.LocalPlayer

script.Parent.MouseButton1Click:connect(function()
	Game:GetService("MarketplaceService"):PromptProductPurchase(player, productId)
end)

3 comments

0

so post the script that isn't working

1

This looks fine, it's probably the buy button script, put that in the post please. You appear to have put the wrong script...

0

The script works fine, thats what i need help with, I get the cash but it won't let me spend it :/