DevProduct - Help

I can’t seems to figure out why my script isn’t work, if someone could help me, I would appreciate it.

MarketplaceService.ProcessReceipt = function(RecepitInfo)
	local Purchasing = Players:GetPlayerByUserId(RecepitInfo.PlayerId)
	if Purchasing then
		if RecepitInfo.ProductId == 1116126549 then
			if Purchasing then
				if Boat.MainParts:FindFirstChild("RobuxButton") then
					local RobuxButton = Boat.MainParts.RobuxButton
					local debRepair = false

					RobuxButton.Display.Label.Text = "CLICK TO REPAIR\n["..tostring(stats.RepairWoodCost).." WOOD]"

					function RepairShip(Player)
						if debRepair then return end
						if CurrentHealth >= stats.Health then return end

						if Player:FindFirstChild("Stats") and Player.Stats:FindFirstChild("Wood") and Player.Stats.Wood.Value >= stats.RepairWoodCost then
							debRepair = true
							RobuxButton.Display.Label.Text = "REPAIRING..."

							Player.Stats.Wood.Value = Player.Stats.Wood.Value - stats.RepairWoodCost

							RobuxButton.Sound:Play()
							RobuxButton.ParticleEmitter.Enabled = true

							CurrentHealth = math.clamp(CurrentHealth + stats.RepairHealthAmount, 0, stats.Health)
							if Boat.Owner.Value and Boat.Owner.Value.Parent and Boat.Owner.Value:FindFirstChild("Ships") then
								if Boat.Owner.Value.Ships:FindFirstChild(Boat.ShipType.Value) then
									Boat.Owner.Value.Ships[Boat.ShipType.Value].Value = CurrentHealth
								end
							end

							wait(0.1)

							RobuxButton.ParticleEmitter.Enabled = false

							wait(stats.RepairCooldown)

							RobuxButton.Display.Label.Text = "CLICK TO REPAIR\n["..tostring(stats.RepairWoodCost).." WOOD]"
							debRepair = false
						end
					end
					RobuxButton.ClickDetector.MouseClick:Connect(RepairShip)
				else
					return Enum.ProductPurchaseDecision.NotProcessedYet
				end
			end
			PreviousPurchases:IncrementAsync(RecepitInfo.PlayerId .. "_" .. RecepitInfo.ProductId, 1)
			return Enum.ProductPurchaseDecision.PurchaseGranted
		else
			return Enum.ProductPurchaseDecision.NotProcessedYet
		end
	end
end

Hello,

What’s the output that you’re getting after running the code? (If there’s any)

Funniest thing is I’m not getting any errors for it.

What is this script have to do? If it’s buying item while player hasnt enough money, change
and Player.Stats.Wood.Value >= stats.RepairWoodCost
To
and Player.Stats.Wood.Value < stats.RepairWoodCost

It’s repairing a ship, originally this script wasn’t made by me, I got hired by to add some details to it. so yea

If there is nothing in output,the problem could be on condition. Does it work rn?

1 Like

Also try to use print after all conditions, so you will get notified if condition was completed

1 Like

I’ll give it try, thank you. I’ll let you know if I can find the bug within the script.