Attempt to index nil with 'OpenScript'

Hello!

I am making a plugin and making it opens a script (descendant that’s a Script/LocalScript/ModuleScript)

but there’s an error that says “attempt to index nil with ‘OpenScript’”

I had no idea what’s going on and I’m doing it right but it gave me this error…

code:

	for i, v in pairs(Model:GetDescendants()) do
		if v:IsA("Script") or v:IsA("LocalScript") or v:IsA("ModuleScript") then
			plugin:OpenScript(v)
		end
	end

Any help is appreciated :slight_smile:

Hey, do you mind showing us what is “plugin” variable?

it’s “plugin”, just “plugin”

(30)

But the plugin seems to be nil.

oh wait it seems to be a modulescript.

I think I’ll do it from the plugin script

and it worked! :smiley:

Yes, :OpenScript can be only called by PluginScripts.

1 Like