So, I want to make it so it tracks the player’s character and skin but i have no idea how to. All i’ve seen were making it the StarterCharacter but that’s not what I’m looking for. For reference, a game like Phighting, or Forsaken. How do they achieve this?
edit note: i was too tired to realize there was more of the code snippet to read … sorry
what I would do is use datastore2 to save the name of the character model you want to save like so:
local players = game:GetService("Players");
local dataStore2 = require(...);
dataStore2.combine("MAIN", "Character");
local function PlayerAdded(player: Player)
local values = Instance.new("Folder");
values.Name = "Values";
values.Parent = player;
local characterValue = Instance.new("StringValue");
characterValue.Name = "Character";
characterValue.Parent = values;
local characterStore = dataStore2("Character", player);
local savedCharacter = characterStore:Get(DEFAULT_CHARACTER_NAME_HERE);
characterValue.Value = savedCharacter;
end
players.PlayerAdded:Connect(PlayerAdded);
for getting and loading characters:
local values = player:FindFirstChild("Values");
local characterValue = values:FindFirstChild("Character");
local characterModel = ...:FindFirstChild(characterValue.Value);
player.Character = characterModel;
with the image you provided there seems to also include other stuff like animations, skins and etc so I don’t really know how you would optimize the idea to work with that but it’s a good start
one more thing to consider is that you should probably also put things that only the server will usually access in serverstorage or serverscriptstorage, it’s a good way to protect your game from exploits that attempt decompilation and it probably gives the client less things to load