How to activate scripts

Screenshot 2023-08-17 184247
i want this script to activate every script in this model

local mps = game:GetService("MarketPlaceService")
local plrs = game:GetService("Players")

function OnDeveloperProductBought(receipt) -- use the parantheses and parameters!
	if receipt.ProductId == 1613997626 then -- double '=' sign to compare (and put 'then')!
		script.Parent.Anchored = true
		script.Parent.Parent = workspace
		script.Parent.Transparency = 1
		-- wait() is unneccessary here
		script.Parent.Nuke.Disabled = false
	end -- place the end at the correct position
end

mps.ProcessReceipt=OnDeveloperProductBought
3 Likes

i want this script to activate every script in this model

2 Likes

Why use multiple scripts instead of using a module script or a function inside of the main script.
Instead of script.Parent.Nuke.Disabled = false make a function for whatever you need then call it instead.

because each script has a unique funtion they need to carry out indevidualy

Also, the way you activate scripts is like you already put in your code
image

i know but im trying to get is so that when the developer product called nuke with the id of 1613997626
is purchased it activates the nuke

just use modules scripts and require them from the main script, setting the Disabled property of a script to false wont run whats inside the script

im new to scripting and dont really know what that means can you show me please

Watch thedevkings video on modules scripts to learn about it.
Advanced Roblox Scripting Tutorial #11 - Module Scripts & Dictionaries (Beginner to Pro 2019)

i know what a module script is but i just dont know what to do iv tried for hours im pretty sure that script should work is there anything wrong with it

you could:

GetDescendants()

if descendant:IsA(“Script”) then
descendant.Disabled = false
end

however modulescripts would be a lot better

man i dont understand this can somebody show pictures

try switching Disabled = false to Enabled = true, Disabled is depracated

or show the edited script because im not good at understanding words im a visual learner

I don’t have the time to really go into module scripts, someone else can help with that, however, I just wanted to add, that yes module scripts are better, however, when you set a scripts.Disabled = false, it DOES run what is in the script.

Yes, Enabled = true is preferred.

a modulescript is a script that you can call.

When you call it it gives you info.

You can call a module like this: local data = require(modulescript)

Inside the modulescript you’ll get this:

local module = {}

return module

return returns the module, and module is a table that contains data

this look right???
local mps = game:GetService(“MarketPlaceService”)
local plrs = game:GetService(“Players”)

function OnDeveloperProductBought(receipt) – use the parantheses and parameters!
if receipt.ProductId == 1613997626 then – double ‘=’ sign to compare (and put ‘then’)!
script.Parent.Anchored = true
script.Parent.Parent = workspace
script.Parent.Transparency = 1
– wait() is unneccessary here
script.Parent.Atom.Enabled = true
end – place the end at the correct position
end

mps.ProcessReceipt=OnDeveloperProductBought

if you want to return say different dialogues using only one script you can place in ReplicatedStorage you would do this:

place a modulescript inside ReplicatedStorage

rename it to “DialogueModule”

Modulescript code:

local dialogues = {“Hello”, “How are you?”}

return dialogues

Server script:

local module = game.ReplicatedStorage.DialogueModule

local info = require(module)

this will return a table containing the following strings: “Hello”, “How are you?”

bro whattttttttttttttttttttttttttttttttttttttttttt