I attempted to store an instance inside a table in a module script. Apparently this doesn’t work, someone please help me.
--tile is a node group object
--contains up to four nodes
local oceanTile = game:GetService("ServerStorage"):WaitForChild("OceanTile")
local Tile = {}
Tile.__index = Tile
function Tile.new(node1,node2,node3,node4)
local self = setmetatable({}, Tile)
self.__index = self
self.nodes = {node1,node2,node3,node4}
for i = 1, #self.nodes do
self.nodes[i]:addTile(self)
end
self.plane = oceanTile:Clone()
self.plane.Parent = workspace.oceanTiles
return self
end
function Tile:getPosition()
return self.plane.Position
end
function Tile:getNodes()
return self.nodes
end
function Tile:setPosition(position)
self.plane.Position = position
end
function Tile:setSize(size)
self.plane.Size = size
end
function Tile:setCFrame(cfram)
self.plane.CFrame = cfram
end
function Tile:getCFrame()
return self.plane.CFrame
end
function Tile:containsNode(node)
for i =1, #self.nodes do
if self.nodes[i] == node then
return true
end
end
return false
end
function Tile:color()
self.plane.BrickColor = BrickColor.random()
end
return Tile