ObjectValue extends to OOP, or no?

I want to make music sessions in my game. A part of my system needs to be able to know who’s session the player is currently in. What I planned on doing was having an ObjectValue stored in the player, referencing what ever session the player’s in. I’ve never tried this before and can not find any sources confirming if this is possible. I want to know if I can do this before I make the entire system.


local objVal = Instance.new("ObjectValue")
objVal.Value = session:new()
1 Like

Object values only hold instances, not modules.

Depending on what the module looks like, you make an array that holds the sessions. Then remove/add them when people leave/join.


This is infact possible, I explain this in detail in my community tutorial.
You should know how to use metatables and this can be achieved with modules.
I used Services as an example but should work for any instance.

Edit: Also make sure you read the replies because there was an issue with methods that was later fixed.