-
What do you want to achieve? Keep it simple and clear!
I want to make it so whenever I use this function it will add height the the tower. It keeps coming back with an error that says
ServerScriptService.Script:4: attempt to call missing method 'addHeight' of table
-
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I could not find any solutions
Here is my module for it
local Tower = {}
Tower.__Index = Tower
function Tower.new()
local newTower = {}
setmetatable(newTower, Tower)
newTower.Height = 0
return newTower
end
function Tower:addHeight()
self.Height = self.Height + 5
end
return Tower
Here is the script
local TowerModule = require(game.ReplicatedStorage.Tower)
local newTower = TowerModule.new()
newTower:addHeight()