Hi everyone,
I’m looking for an effective way to load a character with more specification than LoadCharacterWithHumanoidDescription() provides. I’m trying to achieve something similar to what games like Deepwoken have, where when you join the game and press continue, your custom character loads in with exact accessories and everything. I currently use this and I feel like it’s rather ineffective so I’m wondering how I could improve it to and make it so when a player dies, they respawn with the same values, all help is appreciated.
Players.PlayerAdded:Connect(function(player)
local dataStore = DataStoreModule.new("Player", player.UserId)
dataStore.StateChanged:Connect(stateChanged)
stateChanged(dataStore.State, dataStore)
local skinColor = RacesInfo[dataStore.Value.Race].SkinColor.Value
local humanoidDesc = Instance.new("HumanoidDescription")
humanoidDesc.HeadColor = skinColor
humanoidDesc.TorsoColor = skinColor
humanoidDesc.LeftArmColor = skinColor
humanoidDesc.RightArmColor= skinColor
humanoidDesc.LeftLegColor = skinColor
humanoidDesc.RightLegColor = skinColor
player:LoadCharacterWithHumanoidDescription(humanoidDesc)
local character = player.Character
character.Parent = workspace.Live
local pants = Instance.new("Pants")
local shirt = Instance.new("Shirt")
pants.Parent = character
shirt.Parent = character
shirt.ShirtTemplate = "myShirt"
pants.PantsTemplate = "myPants"
end)
1 Like
Just bumping the post. wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww
I would also love someone to answer this.
Im led to believe they do it the same as we do, but im most likely wrong
Player.CharacterAdded:Connect(function(Character)
local Characterr = Player:LoadCharacter()
local Character = Player.Character
local Humanoid = Character:WaitForChild("Humanoid")
if not Humanoid:IsDescendantOf(game) then
Humanoid.AncestryChanged:Wait()
end
Character.Humanoid.DisplayDistanceType = Enum.HumanoidDisplayDistanceType.None
if Humanoid then
local descriptionClone = game.ServerStorage.HumanoidDescription
descriptionClone.Head = 0
descriptionClone.HeadColor = Color3.fromHex(Player.stats:GetAttribute("Skin"))
descriptionClone.LeftArmColor = Color3.fromHex(Player.stats:GetAttribute("Skin"))
descriptionClone.LeftLegColor = Color3.fromHex(Player.stats:GetAttribute("Skin"))
descriptionClone.TorsoColor = Color3.fromHex(Player.stats:GetAttribute("Skin"))
descriptionClone.RightArmColor = Color3.fromHex(Player.stats:GetAttribute("Skin"))
descriptionClone.RightLegColor = Color3.fromHex(Player.stats:GetAttribute("Skin"))
Humanoid:ApplyDescription(descriptionClone)
Humanoid.MaxHealth = Player.stats:GetAttribute("MaximumHealth")
Humanoid.Health = Player.stats:GetAttribute("MaximumHealth")
end
Character.Head:FindFirstChildOfClass("Decal"):Destroy()
local face = game.ReplicatedStorage.CharacterLoader.Faces:FindFirstChild(Player.stats:GetAttribute("Face")):Clone()
face.Parent = Character.Head
for i,v in pairs(face:GetChildren()) do
v.Parent = Character.Head
end
face:Destroy()
local hair = game.ReplicatedStorage.CharacterLoader.Hairs:FindFirstChild(Player.stats:GetAttribute("Hair")):Clone()
hair.Parent = Character
hair.Handle.Color = Color3.fromHex(Player.stats:GetAttribute("HairColour"))
local armour = game.ReplicatedStorage.CharacterLoader.Armour:FindFirstChild(Player.stats:GetAttribute("Armour")):Clone()
armour.Parent = Character
for i,v in pairs(armour:GetChildren()) do
v.Parent = Character
end
armour:Destroy()