How can i make this activate

ok so i have this nuke that works and i want a script that makes it activate when a developer product called nuke is bought i want it to blow up in every server

1 Like

Use Messaging Service

1 Like

this is the script can sombody put the thing that makes it activate when ever the nuke developer gamepass i purchased in all servers

print("Nuke Em' All")

local CloudID= "http://www.roblox.com/asset/?id=1095708"
local ColorTexture = "http://www.roblox.com/asset/?ID=1361097"
local RingID = "http://www.roblox.com/asset/?id=3270017"
local SphereID = "http://www.roblox.com/asset/?id=1185246"

local BasePosition = script.Parent.Position

local Size = 200

local Exp = Instance.new("Model")
Exp.Name = "ATOMICEXPLOSION"
Exp.Parent = game.Workspace

local BasePart = Instance.new("Part")
BasePart.formFactor = 0
BasePart.TopSurface = 0
BasePart.BottomSurface = 0
BasePart.Anchored = true
BasePart.Locked = true
BasePart.CanCollide = false

local BaseMesh = Instance.new("SpecialMesh")
BaseMesh.MeshType = "FileMesh"

local CloudMesh = BaseMesh:clone()
CloudMesh.MeshId = CloudID
CloudMesh.TextureId = ColorTexture
CloudMesh.VertexColor = Vector3.new(0.9,0.6,0)

local RingMesh = BaseMesh:clone()
RingMesh.MeshId = RingID

local SphereMesh = BaseMesh:clone()
SphereMesh.MeshId = SphereID

local Clouds = {}
local ShockWave = {}
local Sky = script.Sky


function Effects()
	script.Explode:Play()
	delay(0,function() 
		for i = 5, 1,-0.01 do
			wait()
			game.Lighting.Brightness = i
		end
	end)
end

function Destruction(Pos,Radius)
	local function Destroy(Model)
		for i ,v in ipairs(Model:getChildren()) do
			if v:isA("BasePart") then
				if (v.Position-Pos).magnitude < Radius then
					if v.Anchored == false then
						v:BreakJoints()
						v.Velocity = CFrame.new(v.Position,Pos):vectorToWorldSpace(Vector3.new(math.random(-5,5),5,1000))
						v.Material = "CorrodedMetal"
					end	
				end
			end
			if #v:getChildren() > 0 then
				Destroy(v)
			end
		end
	end
	Destroy(game.Workspace)
end
function Explode(Pos)

local Base = BasePart:clone()
Base.Position = Pos
	
local Mesh = CloudMesh:clone()
Mesh.Parent = Base 
Mesh.Scale = Vector3.new(2.5,1,4.5)

local PoleBase = BasePart:clone()
PoleBase.Position = Pos+Vector3.new(0,0.1,0)

local PoleBaseMesh = CloudMesh:clone()
PoleBaseMesh.Scale = Vector3.new(1.25,2,2.5)
PoleBaseMesh.Parent = PoleBase

local Cloud1 = BasePart:clone()
Cloud1.Position = Pos+Vector3.new(0,0.75,0)

local Cloud1Mesh = CloudMesh:clone()
Cloud1Mesh.Scale = Vector3.new(0.5,3,1)
Cloud1Mesh.Parent = Cloud1
	
local Cloud2 = BasePart:clone()
Cloud2.Position = Pos+Vector3.new(0,1.25,0)
	
local Cloud2Mesh = CloudMesh:clone()
Cloud2Mesh.Scale = Vector3.new(0.5,1.5,1)
Cloud2Mesh.Parent = Cloud2

local Cloud3 = BasePart:clone()
Cloud3.Position = Pos+Vector3.new(0,1.7,0)
	
local Cloud3Mesh = CloudMesh:clone()
Cloud3Mesh.Scale = Vector3.new(0.5,1.5,1)
Cloud3Mesh.Parent = Cloud3

local PoleRing = BasePart:clone()
PoleRing.Position = Pos+Vector3.new(0,1.3,0)
PoleRing.Transparency = 0.2
PoleRing.BrickColor = BrickColor.new("Dark stone grey")
PoleRing.CFrame = PoleRing.CFrame*CFrame.Angles(math.rad(90),0,0)

local Mesh = RingMesh:clone()
Mesh.Scale = Vector3.new(1.2,1.2,1.2)
Mesh.Parent = PoleRing

local MushCloud = BasePart:clone()
MushCloud.Position = Pos+Vector3.new(0,2.3,0)
	
local MushMesh = CloudMesh:clone() -- lol
MushMesh.Scale = Vector3.new(2.5,1.75,3.5)
MushMesh.Parent = MushCloud

local TopCloud = BasePart:clone()
TopCloud.Position = Pos+Vector3.new(0,2.7,0)
	
local TopMesh = CloudMesh:clone()
TopMesh.Scale = Vector3.new(7.5,1.5,1.5)
TopMesh.Parent = TopCloud

table.insert(Clouds,Base)
table.insert(Clouds,TopCloud)
table.insert(Clouds,MushCloud)
table.insert(Clouds,Cloud1)
table.insert(Clouds,Cloud2)
table.insert(Clouds,Cloud3)
table.insert(Clouds,PoleBase)
table.insert(Clouds,PoleRing)


local BigRing = BasePart:clone()
BigRing.Position = Pos
BigRing.CFrame = BigRing.CFrame*CFrame.Angles(math.rad(90),0,0)
	
local BigMesh = RingMesh:clone()
BigMesh.Scale = Vector3.new(5,5,1)
BigMesh.Parent = BigRing
	
local SmallRing = BasePart:clone()
SmallRing.Position = Pos
SmallRing.BrickColor = BrickColor.new("Dark stone grey")
SmallRing.CFrame = SmallRing.CFrame*CFrame.Angles(math.rad(90),0,0)

local SmallMesh = RingMesh:clone()
SmallMesh.Scale = Vector3.new(4.6,4.6,1.5)
SmallMesh.Parent = SmallRing

local InnerSphere = BasePart:clone()
InnerSphere.Position = Pos
InnerSphere.BrickColor = BrickColor.new("Bright orange")
InnerSphere.Transparency = 0.5

local InnerSphereMesh = SphereMesh:clone()	
InnerSphereMesh.Scale = Vector3.new(-6.5,-6.5,-6.5)
InnerSphereMesh.Parent = InnerSphere
	
local OutterSphere = BasePart:clone()
OutterSphere.Position = Pos
OutterSphere.BrickColor = BrickColor.new("Bright orange")
OutterSphere.Transparency = 0.5

local OutterSphereMesh = SphereMesh:clone()
OutterSphereMesh.Scale = Vector3.new(6.5,6.5,6.5)
OutterSphereMesh.Parent = OutterSphere

table.insert(ShockWave,BigRing)	
table.insert(ShockWave,SmallRing)
table.insert(ShockWave,OutterSphere)
table.insert(ShockWave,InnerSphere)
	Sky.Parent = game.Lighting
	for i , v in ipairs(ShockWave) do
		v.Parent = Exp
	end
	for i , v in ipairs(Clouds) do
		v.Parent = Exp
	end
	Effects()
	delay(0,function()
		for resize = Size/2.5, Size*3, 2 do
			wait()
			BigRing.Mesh.Scale = Vector3.new(5*resize,5*resize,1*resize)
			SmallRing.Mesh.Scale = Vector3.new(4.6*resize,4.6*resize,1.5*resize)
			InnerSphere.Mesh.Scale = Vector3.new(-6.5*resize,-6.5*resize,-6.5*resize)
			OutterSphere.Mesh.Scale = Vector3.new(6.5*resize,6.5*resize,6.5*resize)
			Destruction(Pos,3*resize)
		end
		for fade = 0, 1, 0.01 do
			wait()
			pcall(function()
				for i ,v in ipairs(ShockWave) do
					v.Transparency = fade
				end
			end)
		end
		for i ,v in ipairs(ShockWave) do
			v:Remove()
		end
		done1 = true
	end)
	delay(0,function()
		for resize = Size/5, Size, 1 do
			wait()
			pcall(function()
				Base.Mesh.Scale = Vector3.new(2.5*resize,1*resize,4.5*resize)
				TopCloud.Mesh.Scale = Vector3.new(0.75*resize,1.5*resize,1.5*resize)
				MushCloud.Mesh.Scale = Vector3.new(2.5*resize,1.75*resize,3.5*resize)
				Cloud1.Mesh.Scale = Vector3.new(0.5*resize,3*resize,1*resize)
				Cloud2.Mesh.Scale = Vector3.new(0.5*resize,1.5*resize,1*resize)
				Cloud3.Mesh.Scale = Vector3.new(0.5*resize,1.5*resize,1*resize)
				PoleBase.Mesh.Scale = Vector3.new(1*resize,2*resize,2.5*resize)
				PoleRing.Mesh.Scale = Vector3.new(1.2*resize,1.2*resize,1.2*resize)

				Base.Position = Pos+Vector3.new(0,0.05*resize,0)
				TopCloud.Position = Pos+Vector3.new(0,2.7*resize,0)
				MushCloud.Position = Pos+Vector3.new(0,2.3*resize,0)
				Cloud1.Position = Pos+Vector3.new(0,0.75*resize,0)
				Cloud2.Position = Pos+Vector3.new(0,1.25*resize,0)
				Cloud3.Position = Pos+Vector3.new(0,1.7*resize,0)
				PoleBase.Position = Pos+Vector3.new(0,0.1*resize,0)
				PoleRing.Position = Pos+Vector3.new(0,1.3*resize,0)
			end)
		end
		done2 = true
	end)
	wait(2)
	for y = 0.6,0,-0.0025 do
		wait()
		for i , v in ipairs(Clouds) do
			v.Mesh.VertexColor = Vector3.new(0.9,y,0)
		end
	end
	for r = 0.9,0.5,-0.01 do
		wait()
		for i , v in ipairs(Clouds) do
			v.Mesh.VertexColor = Vector3.new(r,0,0)
		end
	end
	for by = 0,0.5,0.005 do
		wait()
		for i , v in ipairs(Clouds) do
			v.Mesh.VertexColor = Vector3.new(0.5,by,by)
			v.Transparency = by*2
		end
		Base.Mesh.Scale = Base.Mesh.Scale+Vector3.new(0.1,0.1,0.1)
		TopCloud.Mesh.Scale = TopCloud.Mesh.Scale+Vector3.new(0.1,0.1,0.1)
		MushCloud.Mesh.Scale = MushCloud.Mesh.Scale+Vector3.new(0.1,0.1,0.1)
		Cloud1.Mesh.Scale = Cloud1.Mesh.Scale+Vector3.new(0.1,0.1,0.1)
		Cloud2.Mesh.Scale = Cloud2.Mesh.Scale+Vector3.new(0.1,0.1,0.1)
		Cloud3.Mesh.Scale = Cloud3.Mesh.Scale+Vector3.new(0.1,0.1,0.1)
		PoleBase.Mesh.Scale = PoleBase.Mesh.Scale+Vector3.new(0.1,0.1,0.1)
		PoleRing.Mesh.Scale = PoleRing.Mesh.Scale+Vector3.new(0.1,0.1,0.1)
	end
	done3 = true
	while true do wait(1) if done1 and done2 and done3 then break end end
	Exp:remove()
	wait(20)
	Sky:remove()
end


	

Explode(BasePosition)

script.Parent:remove()
2 Likes

Roblox does say this in the developer forum:

Also your script is quite messy and I don’t understand it enough But reading about the MessagingService does provide a lot of information in what you are trying to do

You will want to make sure you use MessagingService:SubscribeAsync(Topic, CallBackFunction) in all servers. Basically this will be fired whenever a server uses MessagingService:PublishAsync(Topic, Message), which you Connect the PublishAsync when someone buys The developer Product, as Messaging Service will fire to all the active servers with the :SubscribeAsync().

Messaging Service does use Topics which is a string to Identify each ‘message event’, so make sure your Topic is the same string in Both :SubscibeAsync() and :PublishAsync()

Remember that MessagingService Has limits and Is a best effort kind of deal (Not guaranteed to be fired to all servers, Will try).

Limits of messaging Service include
Limit Maximum
Size of message 1kB
Messages sent per game server 150 + 60 * (number of players in this game server) per minute
Messages received per topic (10 + 20 * number of servers) per minute
Messages received for entire game (100 + 50 * number of servers) per minute
Subscriptions allowed per game server 5 + 2 * (number of players in this game server)
1 Like

i already have the script written im just asking for help

1 Like

and what i mean is this i know its also very simple bu tim new to scripting how to i change this to activate when the developer product with the id 1613997626 is purchased

function onTouch(hit)
script.Parent.Anchored = true
script.Parent.Parent = Workspace
script.Parent.Transparency = 1
wait()
script.Parent.Atom.Disabled = false
end

script.Parent.Touched:connect(onTouch)

1 Like

Use MarketplaceService.ProcessReceipt when handling Developer products. There is many YouTube videos and Resources like the Roblox docs on developer products , and I’m sure community tutorials on how to make and detect when one is bought

i already checked and i cant find one for the thingy i want specifically\

What are you wanting specifically that can’t be answered above?

also i dont get why this is not working?

function OnDeveloperProductBought GamepassId = 1613997626
script.Parent.Anchored = true
script.Parent.Parent = workspace
script.Parent.Transparency = 1
wait()
script.Parent.Atom.Disabled = false
end

script.Parent.Touched:connect(OnDeveloperProductBought)

And you can proccess the receipt using any online tutorial that shows how you can Handle a Developer product. You just change when it is bought, and connect the function you have made to it. Again the links I gave you Above explain ProcessRecipt better then I can, and explains the proccess, but if that is not enough, I’m sure you can find videos or other sources by searching