BaseScript And LuaSourceContainer

Are they practically the same thing (BaseClass for all scripts) or is there something different?

1 Like

LuaSourceContainer is the base class for all types of scripts: ModuleScripts, LocalScripts, Scripts, and CoreScripts I think, which you don’t really need to worry about since you cannot create corescripts.

I know what LuaSourceContainer is, I was asking if It’s the same as BaseScript.

BaseScript is a subclass of LuaSourceContainer.

It’s API description is

The base class for all script objects which run automatically.

So Scripts and LocalScripts.

3 Likes

So LuaSourceContainer is a BaseClass for all instances containing code and BaseScript is a subclass of LuaSourceContainer which is for all script objects that run automatically?

Yes. You can even test some of it in the command bar in studio:

local types = {"Script", "LocalScript", "ModuleScript"}

for _, t in ipairs(types) do
	print(t)
	local s = Instance.new(t)
	print("LSC:", s:IsA("LuaSourceContainer"))
	print("BS:", s:IsA("BaseScript"))
	s:Destroy()
end
2 Likes

Thanks, That was very descriptive.