Makes no sense. The code you sent works completely fine for me in my studio, and I’m doing the exact same thing as you. Maybe try reopening studio and see if that fixes anything, or try @Exozorcus 's proposed solution
wait hang on you have to define start inside the initialize method
it prints the SetValues for you?
local aTable = {}
aTable._index = {}
function aTable.initialize(MinSpeed, MaxSpeed, AccelIncrement)
local self = {}
setmetatable(self, aTable)
-- Values --
self.SetValues = {}
self.SetValues.MIN_SPEED = MinSpeed
self.SetValues.MAX_SPEED = MaxSpeed
self.SetValues.ACCEL_INCREMENT = AccelIncrement
self.SetValues.GRAV = workspace.Gravity
function self:start(self2)
print(self.SetValues)
print('yay')
end
print(self)
aTable = self
end
print(aTable)
aTable.initialize()
aTable:start()
this should work
Yes – minimum characters needed
Here’s the code:
local module = require(game.ServerScriptService.ModuleScript)
local MinSpeed = 10
local MaxSpeed = 200
local AccelIncrement = 2
local obj = module.initialize(MinSpeed, MaxSpeed, AccelIncrement)
task.wait(5)
obj:start()
local aTable = {}
local metatable = {__index = aTable}
function aTable.initialize(MinSpeed, MaxSpeed, AccelIncrement)
local self = {}
setmetatable(self, metatable)
-- Values --
self.SetValues = {}
self.SetValues.MIN_SPEED = MinSpeed
self.SetValues.MAX_SPEED = MaxSpeed
self.SetValues.ACCEL_INCREMENT = AccelIncrement
self.SetValues.GRAV = workspace.Gravity
--
return self
end
--
function aTable:start(target)
print(self.SetValues)
end
return aTable
roblox studio weirdness moment
wait… this does work… thats so weird, for some reason its not working in the other script
roblox studio weirdness moment x 2
im wondering if maybe theres a typo somewhere??
well it doesnt work for me so its probably just roblox studio
Just copy my code into your studio and see if it works
wait a sec, i might’ve figured it out. in your server script, you set the “initialize” function call equal to a variable, I didnt do that.
Oh yeah. That’s what it is. Do that and it’ll work
much appreciated, something so simple caused this much of an issue haha
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.