Reposted after 72 hours with no answers

I'm using a separate module script to store my huge tables so that my computer doesn't slow down while writing scripts.

Error

11:36:37.916 - Players.benbebop.PlayerScripts.mainModule:127: attempt to call a table value 11:36:37.917 - Stack Begin 11:36:37.923 - Script 'Players.benbebop.PlayerScripts.mainModule', Line 127 - function newSplash 11:36:37.924 - Script 'ReplicatedFirst.initialiser', Line 77 11:36:37.926 - Stack End

I haven't changed anything from how I normally create module scripts and dont recognize this error. Looking it up returns cases that have nothing to do with my situation. What could be causing this?

Data Module, with tables reduced in size for obvious reasons

local module = {}

function module.getData(num)
	if num == "Splashes" then
		local splashes = {"As seen on TV!","Awesome!","100% pure!"}
		return tostring(splashes[math.random(1, #splashes)])
	elseif num == "ASCIILibrary" then
		return {"NUL","SOH"}
	elseif num == "ASCIILibraryLenght" then
		--return {0,0,0}
	end
end

return module

Requesting script, getData is the above script (lines 126-151)

function mainModule.newSplash()
	local dir = game.Players.LocalPlayer.PlayerGui.Menu.TextDomain
	
	local Splash = getData("Splashes")

	if Splash == "V_CHANCESPLASH" then
		Splash = "This splash is 1 in " .. #Splashes .. "!"
	end

	if math.random(1, 10000) == 1 then
		Splash = ""
	end

	local stringData = {}

	wait(0.1)
	
	dir:ClearAllChildren()
	
	mainModule.writeText(Splash, Color3.fromRGB(255, 255, 0), dir, true, "Center", "Center")

	local goal = {}
	goal.Size = UDim2.new(0, 346, 0, 93)

	TweenService:Create(dir, TweenInfo.new(0.25, Enum.EasingStyle.Quad, Enum.EasingDirection.In, -1, true), goal):Play()
end

writeText Function in case it is needed (lines 16-103)

function mainModule.writeText(text, color, dir, shadow, alignmentx, alignmenty)
	local function createNewLine()
		local newLine = Instance.new("Frame")
		newLine.Name = "Line"
		newLine.LayoutOrder = 0
		newLine.Size = UDim2.new(1, 0, 0, 16)
		newLine.BackgroundTransparency = 1
		return newLine
	end
	
	local function createSorter()
		local sorter = Instance.new("UIListLayout")
		sorter.Padding = UDim.new(0,0)
		sorter.FillDirection = Enum.FillDirection.Horizontal
		sorter.SortOrder = Enum.SortOrder.LayoutOrder
		sorter.HorizontalAlignment = Enum.HorizontalAlignment[alignmentx]
		sorter.VerticalAlignment = Enum.VerticalAlignment[alignmenty]
		return sorter
	end
	
	local newLine = createNewLine()
	newLine.Parent = dir
	
	local sorter = createSorter()
	sorter.Parent = dir
	
	local vertSorter = Instance.new("UIListLayout")
	vertSorter.Padding = UDim.new(0,0)
	vertSorter.FillDirection = Enum.FillDirection.Vertical
	vertSorter.SortOrder = Enum.SortOrder.LayoutOrder
	vertSorter.HorizontalAlignment = Enum.HorizontalAlignment[alignmentx]
	vertSorter.VerticalAlignment = Enum.VerticalAlignment[alignmenty]
	
	for i=1,string.len(text) do
		local char = string.sub(text, i, i)
		if char == " " then
			char = "SPACE"
		elseif char == string.char(10) then
			local newLine = createNewLine()
			newLine.Parent = dir
			
			local sorter = createSorter()
			sorter.Parent = newLine
			
			char = "NUL"
		end
		if shadow == true then
			local vectColor = Vector3.new(color.r, color.g, color.b)
			local characterShadow = script.Parent.Cache.Font["ascii_" .. char]:Clone()
			characterShadow.LayoutOrder = i
			local calcColor = vectColor - Vector3.new(0.752941, 0.752941, 0.752941)
			characterShadow.ImageColor3 = Color3.new(calcColor.x, calcColor.y, calcColor.z)
			local character = characterShadow:Clone()
			character.Parent = characterShadow
			character.Position = UDim2.new(0.5,-2,0.5,-2)
			character.Size = UDim2.new(1, 0, 1, 0)
			character.ImageColor3 = color
			characterShadow.Parent = newLine
		else
			local character = script.Parent.Cache.Font["ascii_" .. char]:Clone()
			character.Parent = newLine
			character.ImageColor3 = color
		end
	end
	return
end

6 comments

0

Where's line 127 of the main module?

0

@TTChaos I added clarification in the post

0

getData is a table

0

@TTChaos that is the point, I want it to return a table.

0

Which line is 127 according to the error which is stated?

0

@SoftlockedUnderZero it is on line 04, the math doesnt add up but I added one line of code since I recorded the error.