Objects aren't initialising

You can write your topic however you want, but you need to answer these questions:
Hello! I’ve been trying to create a sort of profile system for a game I’m creating, which will be a class within a module script.

However, the module simply will not load! The error “Module code did not return one value” keeps popping up, and it’s very unclear why.

Below is the code I used to define the ‘.new’ method for creating an object.

local Profile = {}

Profile.__index = Profile

function Profile.new(player)
	print("started")
	local self = setmetatable({}, Profile)
	
	self.Name = player.Name.."_Profile"
	self.Elo = 1000
	self.Player = player
	
	print("New profile created")
	
	return self
end

If you have any idea on how to make it work, some help would be appreciated

Append return Profile at the end of your ModuleScript. ModuleScripts have to return a value.

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.