I Already know about the Property CharacterAutoLoads, but I was wondering on how to setup this System, So what I’m trying to do is:
Have a DataStore fetch the Players Data
I have already did this part
When the Player joins, get will get their Data, if there is no Data, they will get new Data
Player Spawns In
Here you could just use Player:LoadCharacter(), but what would i do after that?, because it i Enable CharacterAutoLoads it would make it so the Players will all Load In.
Would I have to set up a System where I have to Load the Players Character, or is there a Better way of doing this?
my question would be, why would you need to load the character when the data has finished loading? Couldn’t you just load the data while the character is loaded normally? Unless you are waiting for all the players’ data to finish loading before you start, lets say a storymode game, you can just use tables to hold all the loaded player’s datas, then check if all the datas are loaded before starting
Yes, your died connection would work perfectly. However, I advice that you put this connection in a single script, rather than having a script in every character.
I have modified a script from here that could help:
local Players = game:GetService("Players")
Players.PlayerAdded:Connect(function(player) -- Listen for PlayerAdded to get the player
player.CharacterAdded:Connect(function(char) -- Listen for CharacterAdded to get the player's character
local humanoid = char:WaitFoChild("Humanoid")
humanoid.Died:Connect(function() -- Wait for player's character to die
task.wait(5)
player:LoadCharacter() -- Manually respawn player's character
end)
end)
end)