Hello! I recently got this error: ![]()
I’ve been working with metatables and heres the modulescript and also the serverscript:
Module script:
local module = {}
module.__index = module
function module.new(name, trainNumber, speed, maxspeed, startingpoint, destination)
local train = {}
setmetatable(train, module)
train.Name = name
train.Number = trainNumber
train.Speed = speed
train.MaxSpeed = maxspeed
train.StartingPoint = startingpoint
train.Destination = destination
end
function module:GetTrainName()
print(self.Name, self.Number)
end
function module:TrainStop()
repeat
self.Speed -= 1
until self.Speed <= 0
self.Destination = self.StartingPoint
self.StartingPoint = self.Destination
end
function module:TrainStart()
repeat
self.Speed += 1
until self.Speed >= self.MaxSpeed
end
return module
Server Script:
local train = trainModule.new("Wasp", 212, 0, 150, "Washington DC", "New York")
train:GetTrainName()
I’ve looked in the devforum and couldn’t find anything. Hopefully some of you can answer this question. Thanks!