I am currently trying to make a character chooser in my game. In this character chooser you will buy the characters with in game money. I am hoping that what you’ve bought will save from session to session, so you can re equip the character whenever you join again. Also, I would like to make each character spawn with different weapons, clothes, and special abilities like flips.
I am a bit stuck here, so how would you approach this? What sort of code should I use? Thanks
It all starts with how players get to the point of choosing their character. If you’re not having players choose their characters as soon as they join the game, then I’d have a pre-built shop that detects when a player enters it (.Touched Part on the entrance), and give the user the shop GUI from then on.
If they are choosing their character as soon as they join the game, then I’d prevent their characters from loading and show them a GUI where they can select/purchase the character of their choosing when they join a server.
On the server-side of things, each character would have a folder in ServerStorage correlating to the character by name, and that folder would contain things like DataValue (ObjectValue, NumberValue, StringValue, etc) objects, that character’s special abilities, and the tools that correspond to that character. Alternatively, you can write all of this stuff into a ModuleScript and refer to the actual objects as clones.
When a user selects a character or buys it through the GUI, they would fire a RemoteEvent to the server that says what they’ve selected. Then, the server would check and see if they can buy or select that character, and if they can, append that character to them and load that character into the world and make it so that user gets that character every time they load into the game.
The kinds of things from the wiki that you’ll probably want to look at are:
- RemoteEvents/RemoteFunctions
- StarterPlayer (Service)
- DataValue Objects
- Welds (if you want to just weld the characters to the native character like a morph would)
- Leaderboards