#need some help making a script not run until a lil button gets pressed
1 messages · Page 1 of 1 (latest)
what do you mean by it breaking? couldn't you just connect your script to listen until the button gets pressed?
how does one do this
are you using a click detector to determine when the button is presed?
yes
** You are now Level 4! **
it means that it fires an event when it's clicked
and you can connect a function to that event to start your script
do you need an example, documentation, or just wanna try it yourself?
can i get example plz
give me a sec
this is an alternative
just reference your click detector and perform whatever action you need to do
ty
what if it is a full script i need running not just a text thing
then you can changed the disabled property on scripts
or parent a script to an area it can execute
Initialize the script only when you press the button on another script
Require the script first ofc
how does me setup this
basically you got 2 modules script
yes
the first one is already initialized by the loader module and the other one is required by your first module but the function called Initialize is not triggered until you press button on your first module script
its smth like ->
[First Module]
local SecondModule = Require(script.SecondModule)
clickDetector.MouseClick:Connect(function()
SecondModule.Initialize()
end)
[Second Module]
SecondModule = {}
local function onClicked()
print(action received)
end
Function SecondModule.Initalize()
onClicked()
end)
Return {}
apply this only if you use module scripts
else listen the other guy
but this can avoid you some errors like if we take exemple of map loader if in the second script you try to locate as variable local House = Workspace.House but the house is not loaded yet you will get a error and it will break it but with the Initialize Method you can do what ever you want
:O
hmm?