Hi, I am an amateur at using module scripts but I know some knowledge on it.
I have a module component called CharacterButtons which handles the buttons of a certain gridlayout frame.
Inside the module script I try to REQUIRE another module script that will handle changing the player and etc. Now the error occurs.
Heres the component where I try to require another module and it fails:
--] Variables
local SoundsFolder = script.Parent.Sounds
local Debris = game:GetService("Debris")
local TweenService = game:GetService("TweenService")
local MenuModule = require(game:GetService("ServerScriptService").MenuModule)
local SelectionModule = require(game:GetService("ServerScriptService").SelectionModule)
-- This code is so messy cuz I don't usually work with ui components.
local Menu = {}
Menu.__index = Menu
function Menu.new(player,ui)
local self = setmetatable({},Menu)
self.Player = player
self.Instance = ui
return self
end
function Menu:Initilize()
Menu.ButtonFolders = {
CharacterGrid = self.Instance.Selection.SelectionFrame.CharacterFrame.CharacterGrid
}
for _,frame in ipairs(Menu.ButtonFolders.CharacterGrid:GetChildren()) do
if frame:IsA("Frame") then
for _,button in ipairs(frame:GetChildren()) do
if button:IsA("ImageButton") then
button.MouseButton1Click:Connect(function()
if self.Player:FindFirstChild("Information").HasCharacter.Value == false then
self.Player.Information.HasCharacter.Value = true
local Character = button.Parent.Name
local selection = SelectionModule.new(self.Player,Character)
selection:Initilize() -- this is where the issue starts
button.TextLabel.Text = "Selected"
for i,v in ipairs(button:GetChildren()) do
if v:IsA("UIGradient") then
v:Destroy()
end
end
script.Red:Clone().Parent = button
end
end)
end
end
end
end
end
function Menu:UnselectCharacter()
end
function Menu:ShowClassInfo()
end
return Menu