Help needed with Nuke dev product

Hey, i have a problem i dont know how to add a dev product that once you purchase it the nuke spawns but idk how to add it into the script, can anyone help please?

local rep = game:GetService("ReplicatedStorage")

local TweenService = game:GetService("TweenService")
local original = game.ReplicatedStorage.DeathScriptForNuke
local Nuke = game.ReplicatedStorage.Cloud

local EventProduct = rep:WaitForChild("Product1")

local setCameraShake = rep:WaitForChild("SetCameraShake")
local button1 = script.parent


button1.MouseClick:Connect(function()
	setCameraShake:FireAllClients(true)
	wait(3)
	setCameraShake:FireAllClients(false)
	game.Workspace.SFX.Missile.Playing = true
	wait(7)
	game.Workspace.SFX.Alarm.Playing = true
	game.Workspace.AlarmLight.Part1.alarm.Playing = true
	game.Workspace.AlarmLight.Part1.Script.Disabled = false
	wait(10)
	local Shockwave = Instance.new("Part")
	Shockwave.Parent = game.Workspace
	Shockwave.Anchored = true
	Shockwave.Position = Vector3.new(363.917, 180.108, -0.407)
	Shockwave.Transparency = 1
	setCameraShake:FireAllClients(true)
	local copy = original:Clone()
	copy.Parent = Shockwave

	wait(2)
	local Nuke1 = Nuke:Clone()
	Nuke1.Parent = workspace
	Nuke1.Anchored = true
	Nuke1.Position = Vector3.new(363.917, 166.158, -0.407)
	setCameraShake:FireAllClients(true)
	

	local tweenInfo = TweenInfo.new(20, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 1, false, 1)
	local goal = {}
	goal.Size = Vector3.new(9000.54, 9000.54, 9000.54)
	local tween = TweenService:Create(Shockwave, tweenInfo, goal)
	tween:Play()
	wait(5)
	Shockwave:Destroy()
	
	local tweenInfo = TweenInfo.new(100, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 1, false, 1)
	local goal = {}
	goal.Size = Vector3.new(9000.54,0, 9000.54)
	local tween = TweenService:Create(Nuke1, tweenInfo, goal)
	tween:Play()
	wait(150)
	Nuke1:Destroy()
	end	
end)

wait(30)
	
game.Workspace.AlarmLight.Part1.alarm.Playing = false
game.Workspace.SFX.Alarm.Playing = false
game.Workspace.AlarmLight.Part1.Script.Disabled = true

thx for reading.

use

game:GetService("MarketplaceService"):PromptProductPurchase(player here, Product Id here)

its not working, sorry its gives errors on the player

How do you run it?

can you show me so I can check what is causing the error

(or show me the output)

The player you have given seems to be nil

show me the code? (show me how you run the :PromptProductPurchase())

“player” variable isn’t assigned, that’s the problem

ye and how do i get it from a normal script?

Replace “player” with game.Players.LocalPlayer.

He’s using a normal script (server-sided)

game.Playes.LocalPlayer works for LocalScripts only

Replace button1.MouseClick:Connect(function() with button1.MouseClick:Connect(function(player)

its sort of working but not fully bc it already happens like it happens already when i only gert the choise to buy it or not

use PromptPurchaseFinished

I think

Look into purchase receipt docs.