Hello. I’m testing out OOP in Lua for the first time and I’ve gotten stuck on passing object values to the client.
function Challenge.new(name, minPlayers, instructions)
local self = setmetatable({}, Challenge)
self.Name = name
self.MinPlayers = minPlayers or 1
self.Instructions = instructions
return self
end
This is my constructor method.
function Challenge:ShowTitle(speed)
speed = speed or 1
print(self.Name)
fadeText:FireAllClients(self.Name, speed)
end
This is a method I wrote to fire to the client. However, self.Name isn’t getting passed through. I had wrote that print statement as a quick test to make sure that self.Name was getting saved as a value, and it’s printing to the output log.
I’m wondering what the fix would be in replicating OOP values to the client.