How to disable module scripts

Title pretty much says it all, I want to do this via code btw.

1 Like

i dont think you can do that and why do you wanna disable it in the first place

The script makes it so that shiftlock is enabled, and I want to disable that after a condition is met. I just need to know how to disable the script.

cant you have a shiftlockmodule:Disable() function in it? to disable the shiftlock

It isnt really shift lock but a side shoulder view, I shouldn’t have said shift lock.

You can only disable the script not the module script.

Edit: If you want to disable the script just do:

script.Disabled = true

I don’t think the Disabled property is visible on the properties tab, but available on the script.

Disable the script that calls the modulescript

1 Like

You cannot disable module scripts.

But in scripting when I get this problem, I remove the module script and use the if statement. So it will check if still module script exists, then run it, if not then it won’t run.

For example:

-- ModuleScript:Destroy()
-- if game.ServerScriptServices:FindFirstChild('ModuleScript') then
 -- print("Module Script still exist so script run it.")
-- Dot dot.
 --- else
-- print("Module Script removed! Script will now stop running module script."')
end

Or the other way:

How would that look like? I know how to use connection but I think that is only for local scripts…

You have to find the script that requires the module and disable that script inside the properties window where it says “Disabled” and just click the check box.

So it looks like this
image

Module scripts dont have that selection, thats why I made this discussion.

Yes, that is correct module scripts don’t have that but the script that requires the module does. The module does nothing without the script that calls it. Where is the module located in the explorer?

What kind of script is it? Like a custom camera? Could you provide some information please?

Oh I see what you mean. I cant look at it right now cause Im on mobile but ill check later :smiley:

I saw above that you wanted to disable the ability to use shitlock after a condition is met and this might help a bit with what you are trying to do. Not sure if this is what you wanted but I hope it helps. Player | Roblox Creator Documentation.

Didn’t he said that it isn’t really a shift lock but a side shoulder view?

Don’t call a function in the module script, then it won’t run. You can’t just turn it off

To be honest, I don’t really know. This whole thing is a bit confusing.

I mean couldn’t you make a disable function for the shift lock?

local Shiftlock = {Enabled = false}

function Shiftlock:Enable()
  self.Enabled = true
  -- Turn the camera on here?
end

function Shiftlock:Disable()
  self.Enabled = false
  -- Turn the camera off here?
end

return Shiftlock
1 Like