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
9 Likes

i want this script to activate every script in this model

3 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.

2 Likes

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

2 Likes

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

2 Likes

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

3 Likes

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

2 Likes

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

3 Likes

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

2 Likes

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

2 Likes

you could:

GetDescendants()

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

2 Likes

however modulescripts would be a lot better

3 Likes

man i dont understand this can somebody show pictures

2 Likes

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

2 Likes

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

1 Like

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.

1 Like

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

1 Like

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

1 Like

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?”

1 Like

bro whattttttttttttttttttttttttttttttttttttttttttt

1 Like