that doesn’t autofill but I want it to autofill and I want to be able to do pluginToolbar and properties like that. Same for everything else. Can modules have a plugin runcontext?
So the thing about modules is they do not have access to the plugin value by default. You’d have to pass the plugin value to said module.
if you want it to appear in autocomplete you’d have to also define it as a value, what I do personally is this:
local plugin:plugin
local module = {}
module.setup = function(PluginObject)
plugin = PluginObject
end
return module
it doesnt need to be exactly like that, but something similar still gets the job done!
so I tried that and I did this
local plugin:plugin
local module = {}
module.Initialize = function(PluginObject)
plugin = PluginObject
end
module.CreateButton = function()
plugin:create
end
return module
though nothing that is a function of plugin is autofilling still since :plugin is not a type in none plugin context scripts
I see that now, I think roblox might have changed it cause I remember :plugin being a type I could use, that or my memory is bad.
In that case I dont think theres anything you can do to autofill the properties and functions of plugin, but at least the autofill shows the plugin variable now!
well it’s sad I can’t change a module’s runcontext (I get it’s a module so it can’t support that as well but atleast give me access to plugin variables if I want), thanks for the help
local plugin: Plugin = script:FindFirstAncestorWhichIsA("Plugin")
Plugin
is a type, try that, like:
local plugin: Plugin
module = {}
function module.setup(reference)
plugin = reference
end
function module.button()
-- should have autocomplete for plugin here
end
return module
thinking about it now, it might be cause of the new type solver, I havent messed with this stuff in a while, but I know when I did it wasnt enabled. Are you using it? That or its the Incremental typechcking and autocompletion
I actually disabled that because of how bad it was, I just checked and it is still disabled so that isn’t the problem
oh wow I didn’t know it was in settings or even feature at all