Problem with a nuke script

So the first problem is the nuke prompting, whenever a player wishes to buy a nuke he will get a confirmation prompt asking him if he is sure about it and if he clicks yes it prompts the developer product if he clicks no it closes the prompt ui but when I open it again it doesn’t show the text of asking the player to prompt or even showing yes/no
That’s how it should look like:
image
That’s how it looks like when it comes for the second time:
image
Now the second problem, When a player buys the nuke it launches perfectly but in the second time of buying it, It shows this error:
image
The error is in this part of code btw

local function PromptComing()
	Prompt.Visible = true
	Prompt:TweenPosition(
		UDim2.new(0.4, 0, 0.4, 0),
		"Out",
		"Elastic",
		1,
		true
	)
end

For the third problem, Again when firing for the second time it will not fire the events shown in the script below like the same problem in my old post Problem with developer product But this time I am disconnecting but it is in a local script unlike a script so I am unsure if it differs.
Any help would be appreciated for these 3 problems :slight_smile:
Local Script:

local Player = game.Players.LocalPlayer
local Char = Player.Character or Player.CharacterAdded:Wait()
local NukeFolder = game.Workspace.Nuke
local Nuke = NukeFolder.Nuke
local NukePrompt = NukeFolder.NukePrompt.ProximityPrompt
local Prompt = Player.PlayerGui:WaitForChild("Nuke").Prompt
local Yes = Prompt.Yes
local No = Prompt.No
local TextOfPrompt = Prompt.Text
local MPS = game:GetService("MarketplaceService")
local DPID = 1299613952
local Siren = script.Siren
local ExplosionSound = script.Explosion
local TS = game:GetService("TweenService")
local Rs = game:GetService("ReplicatedStorage")
local CameraShake = Rs.Nuke.CameraShake
local Explosion = Rs.Nuke.Explosion
local Launch = Rs.Nuke.Launch
local AnimatedTextEvent = Rs.Nuke.AnimatedText
local ChatText = Rs.Nuke.ChatText
local AnimatedTextEventLabel = Player.PlayerGui:WaitForChild("Nuke").TextLabel
local function AnimatedText(object, text)
	for i = 1, #text, 1 do
		object.Text = string.sub(text, 1, i)
		wait(0.05)
	end
end
local function YesNoComing()
	for i = 1, 0, -0.1 do
		Yes.Transparency = i
		No.Transparency = i
		wait(0.01)
	end
end
local function PromptComing()
	Prompt.Visible = true
	Prompt:TweenPosition(
		UDim2.new(0.4, 0, 0.4, 0),
		"Out",
		"Elastic",
		1,
		true
	)
end
local function PromptGoing()
	Prompt:TweenPosition(
		UDim2.new(0.4, 0, -0.3, 0),
		"Out",
		"Linear",
		0.5,
		true
	)
	wait(0.5)
	Prompt.Visible = false
end
local function TextGoing()
	for i = 0, 1, 0.1 do
		TextOfPrompt.TextTransparency = i
		wait(0.01)
	end
end
local function YesClicked()
	MPS:PromptProductPurchase(Player, DPID)
	CameraShake:FireServer()
	Explosion:FireServer()
	Launch:FireServer()
	AnimatedTextEvent:FireServer()
	ChatText:FireServer()
	No.Visible = false
	Yes.Visible = false
	TextGoing()
	PromptGoing()
end
local function NoClicked()
		Yes.Visible = false
		No.Visible = false
		TextGoing()
		PromptGoing()
end

local function ALLEVENTS()
	--CameraShake
	CameraShake.OnClientEvent:Connect(function()
		local function CS(time)
			local ST = tick()
			while true do
				if tick() - ST >= time then break end
				local X = math.random(-300, 300) / 1000
				local Y = math.random(-300, 300) / 1000
				local Z = math.random(-300, 300) / 1000
				Char:WaitForChild("Humanoid").CameraOffset = Vector3.new(X, Y, Z)
				workspace.CurrentCamera.CFrame *= CFrame.Angles(X / 300, Y / 300, Z / 300)
				wait()
			end
			Char:WaitForChild("Humanoid").CameraOffset = Vector3.new(0, 0, 0)
		end
		CS(30)
	end)
	--Launching
	Launch.OnClientEvent:Connect(function()
		local Info = TweenInfo.new(5, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0)
		local Info2 = TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0)
		local WhatToDo1 = {
			Position = Vector3.new(3.585, 182.825, 56.33)
		}
		local WhatToDo2 = {
			Orientation = Vector3.new(-90, -180, 0)
		}
		local WhatToDo3 = {
			Position = Vector3.new(3.585, 3.129, 56.33)
		}
		local NukeGoingUpFunction = TS:Create(Nuke, Info, WhatToDo1)
		local NukeRotatingFunction = TS:Create(Nuke, Info, WhatToDo2);
		local NukeGoingDownFunction = TS:Create(Nuke, Info2, WhatToDo3)
		Siren:Play()
		wait(5)
		NukeGoingUpFunction:Play()
		wait(5)
		NukeRotatingFunction:Play()
		wait(5)
		NukeGoingDownFunction:Play()
		wait(1)
		--Explosion
		Explosion.OnClientEvent:Connect(function()
			NukeFolder.ExplosionEffect.Transparency = 0.5
			local Infoforexplosion = TweenInfo.new(
				10,
				Enum.EasingStyle.Linear,
				Enum.EasingDirection.Out,
				0
			)
			local ResizingTable = {
				Size = Vector3.new(1203.79, 1203.79, 1203.79)
			}
			local TweenCreate = TS:Create(NukeFolder.ExplosionEffect, Infoforexplosion, ResizingTable)
			TweenCreate:Play()
			for i, v in pairs(game.Players:GetChildren()) do
				v.Character.Humanoid.Health = 0
			end
			ExplosionSound:Play()
			wait(15)
			for i = 0.5, 1, 0.1 do
				NukeFolder.ExplosionEffect.Transparency = i
				wait(0.01)
			end
			for i = 0, 1, 0.1 do
				Nuke.Transparency = i
				wait(0.01)
			end
			Nuke.Position = Vector3.new(3.585, 3.399, 56.33)
			Nuke.Orientation = Vector3.new(90, 0, 0)
		end)
	end)
	--AnimatedTex
	AnimatedTextEvent.OnClientEvent:Connect(function(player)
		AnimatedTextEventLabel.Visible = true
		AnimatedText(AnimatedTextEventLabel, player.Name.." Has launched a nuke!!!")
	end)
		--ChatText
	 ChatText.OnClientEvent:Connect(function(player)
		game.StarterGui:SetCore("ChatMakeSystemMessage",
			{
				Text = "[Server]: "..player.Name.." Has launched a nuke!!!",
				Size = 20,
				Color = Color3.new(1, 0, 0),
				Font = Enum.Font.DenkOne
			}
		)
	end)
	wait(18)
end
NukePrompt.Triggered:Connect(function()
	PromptComing()
	wait(1)
	AnimatedText(TextOfPrompt, Player.Name.." are you sure you would like to buy NUKE?")
	YesNoComing()
	Yes.MouseButton1Up:Connect(function()
		YesClicked()
		NukePrompt.Enabled = false
		ALLEVENTS()
		wait(30)
		for i = 1, 0, -0.1 do
			Nuke.Transparency = i
			wait(0.01)
		end
		NukePrompt.Enabled = true
	end)
	No.MouseButton1Up:Connect(function()
		NoClicked()
	end)
end)

Script:

--Main Services
local RS = game:GetService("ReplicatedStorage")
local MPS = game:GetService("MarketplaceService")
--Nuke
local DPID = 1299613952
local CameraShake = RS.Nuke.CameraShake
local Explosion = RS.Nuke.Explosion
local Launch = RS.Nuke.Launch
local AnimatedTextEvent = RS.Nuke.AnimatedText
local ChatText = RS.Nuke.ChatText



MPS.ProcessReceipt = function(receiptinfo)
	local player = game.Players:GetPlayerByUserId(receiptinfo.PlayerId)
	if not player then
		return Enum.ProductPurchaseDecision.NotProcessedYet
	end
	if receiptinfo.ProductId == DPID then
		CameraShake:FireAllClients()
		Explosion:FireAllClients()
		Launch:FireAllClients()
		AnimatedTextEvent:FireAllClients(player)
		ChatText:FireAllClients(player)
	end
	return Enum.ProductPurchaseDecision.PurchaseGranted
end

Seems you are disabling the text somewhere and not re enabling it.

1 Like

Well thank you for solving the first problem! :slightly_smiling_face: