How would I call a function from a module script?

I cannot call this function from my script! Any help?

local module = {}

local function newTopbar(name, image, width)
	local newButton = script.Buttons.Template:Clone()
	newButton.Name = name
	newButton.Size.Width = width
	newButton.Icon.Image = image
	for _, player in pairs(game:GetService("Players"):GetPlayers()) do
		local Button = newButton:Clone() 
		Button.Parent = player.PlayerGui.TopBarUI.Bar
	end
end

return module

1 Like

Add a : or . Operators to your Module:

local module = {}

function module.Something()
end

function module:Something2() -- Usually Used for OOP (Object Oriented Programming)
end

return module
local Module = require(module)

Module.Something()
Module:Something2()
1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.