Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How can I properly include the middleclass library into a Roblox project?

Asked by
xVirtx 0
6 years ago
Edited 6 years ago

This Library: middleclass

I have the middleclass.lua file in my Workspace and ServerScriptService (just to test and get something working).

When I try to use:

local class = require 'middleclass'

or

local class = require('middleclass')

I get this error: Attempted to call require with invalid argument(s).

I thought maybe in Roblox, you have to include this library some other way? I also tried this:

local class = game.ServerScriptService.middleclass

But when I try to actually create a class like this:

Player = class('Player', Character)
function Player:initialize()
    Character.initialize(self, 1)
end

I get this error: Player is not a valid member of Script

Does anyone know how I can integrate this library? I'm still pretty new to Roblox Studio and lua, I imagine it is something easy that I'm just missing.

Answer this question