I want that it stays as an Instance and not a table, how do I achieve this?
The issue is that if I use a function from a module script and I need an Instance to execute the full function, I gave an Instance, but it turned into a table that contains all functions of my module script.
I looked for solutions, but couldn’t find any.
Script where I used the module script:
local lib = require(game.ReplicatedStorage["Testing Purposes"])
local screenGUI = lib.createScreenGUI(game.Players.LocalPlayer, "Testing GUI")
print(lib.screenGUI)
--local mainGUI = lib:createMainMenu(game.Players.LocalPlayer["Testing GUI"], UDim2.new(0, 285, 0, 267), UDim2.new(0, 285, 0, 267), "Main", "DracoLib Testing", Color3.fromRGB(0, 234, 255), Color3.fromRGB(72, 72, 72))
lib:testing(lib.screenGUI)
module script:
local module = {}
local screenGUI
module.createScreenGUI = function(parent, name)
local ScreenGui = Instance.new("ScreenGui", parent)
ScreenGui.Name = name
ScreenGui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
module.screenGUI = ScreenGui
screenGUI = ScreenGui
return ScreenGui
end
module.createMainMenu = function(parent, position, scale, name, title, titleColor, color)
local Main = Instance.new("Frame")
Main.Name = "Main"
Main.Parent = screenGUI
Main.BackgroundColor3 = color
Main.Position = position
Main.Size = scale
Main.Active = true
Main.Draggable = true
Main.Visible = true
if title == nil then
module.mainMenu = Main
return Main
end
local TitleHolderMain = Instance.new("Frame", module.mainMenu)
TitleHolderMain.Name = "TitleHolderMain"
TitleHolderMain.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
TitleHolderMain.Size = UDim2.new(position.X.Scale, position.X.Offset, 0, 25)
module.mainMenuTitleHolder = TitleHolderMain
local TitelMain = Instance.new("TextLabel", TitleHolderMain)
TitelMain.Name = "TitelMain"
TitelMain.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
TitelMain.BackgroundTransparency = 1.000
TitelMain.Position = UDim2.new(0.147368416, 0, 0, 0)
TitelMain.Size = UDim2.new(0, 200, 0, 25)
TitelMain.Font = Enum.Font.SourceSans
TitelMain.Text = title
TitelMain.TextScaled = true
TitelMain.TextSize = 14.000
TitelMain.TextWrapped = true
if titleColor then
TitelMain.TextColor3 = Color3.fromRGB(0, 211, 230)
end
return Main
end
module.testing = function(parent2) --used this function
print(parent2)
end
return module
