Keep track of what character player is using

The game I’m currently working on is a character based fighting game, where you can buy characters based on wins-each having their own abilities. I started making configs for each character, but I’m wondering how to keep track of them. For example, what I’ve previously done is attributes inside the character, but I’m not fully sure if this is the correct way? Furthermore, the game already has profilestore implemented for leaderstats, should I use that for the characters?

so let me figure out what you’re asking - you want to know what character is the player using currently? Something like

GetCurrentUsingCharacter(player) returns the characters name?

1 Like

Well yes and no, like what current character that they bought.

For example, the starter character is a noob. Your current character is said noob. You buy a bacon hair in the shop. Now, your character is a bacon hair. Lets say they leave, and then rejoin. How should I go about detecting that?

Players.PlayerAdded/PlayerRemoving can fire events for you to track when players leave or join. To save their progress/character, just use a datastore and save to it when they leave the game, and load it when they join.

1 Like

Ohh i understand!
this is similar to the game I’m working on!!

What i did is,

i have 11 characters, each of them’s name is a number like from 1 - 11.

so i made a Value called CurrentHero inside a folder called HeroFolder inside player.

a datastore script saves the data when .PlayerRemoving.

so example when you click the ‘BUY’ button at the bacon hair’s shop ui. after buying it sets your CurrentHero to 2 (assuming that noob is 1, bacon is 2, and others…), so since your datastore saved that value when you leave, when you join, it still will be 2!

so you can make a invisible morph pad near the spawn which will change the player’s character to the one inside the CurrentHero Value

Hope this helps, since this is how i made it!

1 Like

saving it in datastore? Data stores | Documentation - Roblox Creator Hub

Look at this implementation ProfileStore - Save your player data easy (DataStore Module) of saving data
Pretty good example how you must implement datastore saving.

1 Like

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