Hey guys,
I'm making a card game on Roblox.
Currently, I have 2 modules and one server script.
ModuleScripts:
Deck
Deck = {}
Deck.__index = Deck
function Deck.new(suit,rank)
local newDeck ={}
setmetatable(newDeck, Deck)
newDeck.Suit = suit
newDeck.Rank = rank
return newDeck
end
return Deck
Visualize
local Deck = require(game.ServerScriptService.Modules.Deck)
local Vis = {}
Vis.__index = Vis
function Show()
print((Deck.Rank).." of "..(Deck.Suit))
end
return Vis
Server:
Deal
local Deck = require(game.ServerScriptService.Modules.Deck)
local Vis = require(game.ServerScriptService.Modules.Visualize)
newDeck = Deck.new("Diamonds",math.random(2,14))
Vis.Show()
All I'm trying to do is print the values of the new deck (Vis) created in (Deck). this works if I do everything in the server script, for some reason I'm getting the following error:
ServerScriptService.Deal:5: attempt to call a nil value
I feel like there's something super obvious I'm missing but I can't seem to put my finger on it..
Thanks in advance!

4 comments
Shouldn't it just be "Show()" instead of Vis.Show()?
Since the "Show()" function is located in the visualize ModuleScript, and I'm calling it from Deal, I have to locate it by Vis.Show()
You never bound the method to the Object: function Vis:Show().
local newDeck = setmetatable({}, Deck) - returns the metatable being set.