How would I make a family system?

I’m wondering how I would make a family system in my game. I already have a first name system, and a last name system. The family contains the nuclear family, extended family, and grandparents family. The player’s age also is accounted for in this system.

3 Likes

Explain wat you mean I don’t get it

To be more clear on the last name system, your last name is actually a clan. Anyone within this clan can have another person in that same clan in their family tree.

A player in the game would spawn in, and if another player in the current server, meets the requirements:

  • Age over 17
  • Their own family name

They could start their family tree. They can have a brother, sister, father, mom, son, daugther, niece, nephew, aunt, uncle, grandmother, grandfather, cousin, grandson, or even a granddaugther.

The requirements to join a family are simple, but depends on your age:

  • You cannot already have your own family tree that you have either joined or created
  • Age placements:

17 > Age - you can be a child / sibling to someone in the family tree.
17 < Age < 60 - You can have someone as a child to you, and you can be a child / sibling to someone else. No spouses exist, as any adult already inside the tree below the age of 60 will your sibling.
60 < Age - You can only have a child that is above the age of 17, and you can have a grandchild. You will not have any parent.

Is the age and family name based off ROBLOX?

Roblox does not allow devs to use the age of the players.

Then I’d suggest for efficiency you put all your core functions into a module script and call them from a ServerScript.

It’s in theory a bit complicated but not hard to do at all. Clearly you’ll be needing datastores, RemoteEvents, UI framework and the rest. While I’m not going to explain to you how to make it in full depth I’ll provide some links here with relevant information for the tasks you might find yourself scripting.

GuiObject.MouseButton1Click → Event that fires when a player clicks a button on a user interface.
DataStore2 → Wrapper module for roblox datastores but with more secure and frequent methods of saving data.
RemoteEvents → Passing data from the server to the client and vice versa.

Other than that, the rest is regular scripting. Follow some tutorials on certain aspects you may be unsure on!

Disclaimer: Make sure the “age 17” thing is a game based mechanic and not genuinely roblox based as thats against the tos.

The player’s age is randomly generated between 8 and 13.

I know how to use all that you’ve listed. I’m not new to scripting, I’m just confused on where to start with this. For example, I’m thinking about how to manage even just the family trees. What special key can I use for each family tree, and how could I makes slots or someway to check if a sibling, parent, or child already exists?

Implement a tree datatype.

It would follow a format like

  • Node or Vertex object (represents a single family member)
  • Hierarchy (ancestor nodes are ancestors to the family member; descendant nodes are descendants to the family member)
  • Root node could be all families, while its children are individual clans

Module scripts offer an easy way to create OOP class objects, so this could be useful with big data involved with the family. But you can also accomplish the same tree creation with a series of physical objects (like string values), which is easier to visualize in explorer mode.

As far as joining the family, I would make a dynamic UI for when users join the game and construct a UI tree with the tree object. Use recursion on each node, so that the node object creates a UI that shows the member already in a tree and a UI object as a leaf to that node of a possible opening to be in the tree. You can first check the tree depth, and use that to filter out openings in the tree if the players age doesn’t require it.

As far as joining the family, you could use a dynamic UI where when they join the family a UI is constructed using recursion on all tree nodes and incrementing depth every recurse. You can create button objects for where a player can join under a parent node.

That’s how I’d implement it; if you’re using datastores then you can store these as tables (all roblox objects are essentially tables). And everything as far as checking relevance to silbings/children/etc. is basic tree navigation.