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

Nuke dev product not working?

When I try to make a nuke in my game it lets me buy the dev product and it does shake the camera but it doesn't actually clone the nuke. I am using a remote event to start both of these scripts but it either doesn't clone at all or either clones before I pay for the dev product. So the first script is the one that purchases the dev product:(Works)

local Id = 1147482990
local MPS = game:GetService("MarketplaceService")
local Player = game.Players.LocalPlayer

script.Parent.MouseButton1Click:Connect(function()
	MPS:PromptProductPurchase(Player, Id)
end)

This script processes the receipt and fires the remote events:(Works, it fires the one called Remote Event but it doesn't fire the one called GUI for some reason?) Its in ServerScriptService

local Mps = game:GetService("MarketplaceService")
Mps.ProcessReceipt = function(ReciptInfo)
	if ReciptInfo.ProductId == 1147482990 then
		local Player = game.Players:GetPlayerByUserId(ReciptInfo.PlayerId)
		game.ReplicatedStorage.RemoteEvent:FireAllClients(Player)
		game.ReplicatedStorage.GUI:FireAllClients(Player)
		return Enum.ProductPurchaseDecision.PurchaseGranted
	end
end

This script is in StarterPlayerScripts and it makes the camera shake:(Works)

local Player = game.Players.LocalPlayer
local Remote = game.ReplicatedStorage:WaitForChild("RemoteEvent")

Remote.OnClientEvent:Connect(function()
	local Hum = Player.Character.Humanoid
	for i = 1,140 do
		wait()
		print("C")
		Hum.CameraOffset = Vector3.new(
			math.random(-1,1),
			
			math.random(-1,1),
			
			math.random(-1,1),
			
			math.random(-1,1),
			
			math.random(-1,1),
			
			math.random(-1,1),
			
			math.random(-1,1),
			
			math.random(-1,1),
			
			math.random(-1,1),
			
			math.random(-1,1),
			
			math.random(-1,1),

			math.random(-1,1)
			
			)
	end
	Hum.CameraOffset = Vector3.new(0,0,0)
end)

This is the script that also is in StarterPlayerScripts and it is supposed to clone the nuke when the purchase has been granted(Doesnt work and I bet there is something wrong with the script?)

local ReplicatedStorage = game:GetService("ReplicatedStorage")

local remoteEvent = ReplicatedStorage:WaitForChild("RemoteEvent")

game.Lighting.Nuke:clone().Parent = game.Workspace
game.Workspace.Nuke:MoveTo(Vector3.new(570.494, 48.287, 5.565))

Anyone got ideas?

1 answer

✓ Accepted answer

I think you forgot to add remoteEvent.OnClientEvent for the nuke clone code

local ReplicatedStorage = game:GetService("ReplicatedStorage")

local remoteEvent = ReplicatedStorage:WaitForChild("RemoteEvent")

remoteEvent.OnClientEvent:Connect(function()
	game.Lighting.Nuke:clone().Parent = game.Workspace
	game.Workspace.Nuke.Humanoid:MoveTo(Vector3.new(570.494, 48.287, 5.565))
end)

Also reminder for you, :clone() is deprecated and you should use :Clone() instead!

7 comments

0

BRUH im so dumb XD I need to relocate the place it clones as it clones in the wrong place for some reason. I this works ill accept it

0

Check out my new question as its a follow up and you could get another accepted answer for it

0

ummm it works but it spawns two of them in the same place, any way to kind of only let it spawn once before being spawning again

0

ummm it works but it spawns two of them in the same place, any way to kind of only let it spawn once before being spawning again

0

What would the script be then. Im not being lazy I just never understood debounce. I tried it before but it just wouldnt work at all. If you dont want to write it in Ill ask someone else as you helped me a lot anyway :)

0

I answered another question of yours

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