Untitled
unknown
plain_text
10 months ago
8.7 kB
17
Indexable
local Random = Random.new()
local Server = require(script.Parent.Parent);
local Names = Server.Stats.Modules["Names"]
local Races = {
Human = 60,
Vista = 8,
Fanalis = 8,
Piglin = 8,
Dragonkin = 8,
Imuchakk = 8,
}
local SkinTones = {
Human = {
BrickColor.new("Nougat"),
BrickColor.new("Light orange"),
BrickColor.new("Pastel brown"),
},
Vista = {
Color3.fromRGB(161, 126, 102)
},
}
local HairColors = {
Human = {
Blonde = {
Color3.fromRGB(254, 243, 187),
Color3.fromRGB(160, 132, 79),
},
Brown = {
Color3.fromRGB(124, 92, 70),
Color3.fromRGB(71, 54, 45),
},
Dark = {
Color3.fromRGB(91, 93, 105),
Color3.fromRGB(17, 17, 17),
},
},
Fanalis = {
Color3.fromRGB(234, 84, 119),
Color3.fromRGB(245, 29, 86),
},
Imuchakk = {
Color3.fromRGB(108, 145, 232),
Color3.fromRGB(27, 47, 116),
}
}
local TextureIds = {
[Enum.NormalId.Top] = "rbxassetid://6972984234",
[Enum.NormalId.Bottom] = "rbxassetid://6972984234",
[Enum.NormalId.Front] = "rbxassetid://6972984234",
[Enum.NormalId.Back] = "rbxassetid://6972984234",
[Enum.NormalId.Left] = "rbxassetid://6972984234",
[Enum.NormalId.Right] = "rbxassetid://6972984234"
}
local GetColorWeighted = function(Race)
local Tone = math.random(3)
if Race == "Human" or not HairColors[Race] then
if Tone == 1 then
local Alpha = Random:NextNumber(0, 1)
local Color = HairColors.Human["Blonde"][1]:Lerp(HairColors.Human["Blonde"][2], Alpha)
return Color.R * 255, Color.G * 255, Color.B * 255
elseif Tone == 2 then
local Alpha = Random:NextNumber(0, 1)
local Color = HairColors.Human["Brown"][1]:Lerp(HairColors.Human["Brown"][2], Alpha)
return Color.R * 255, Color.G * 255, Color.B * 255
else
local Alpha = Random:NextNumber(0, 1)
local Color = HairColors.Human["Dark"][1]:Lerp(HairColors.Human["Dark"][2], Alpha)
return Color.R * 255, Color.G * 255, Color.B * 255
end
else
local Alpha = Random:NextNumber(0, 1)
local Color = HairColors[Race][1]:Lerp(HairColors[Race][2], Alpha)
return Color.R * 255, Color.G * 255, Color.B * 255
end
end
local function GetSkinColor(Race)
if SkinTones[Race] then
return SkinTones[Race][math.random(#SkinTones[Race])]
else
return SkinTones["Human"][math.random(#SkinTones["Human"])]
end
end
local function LerpColors(Lightest: Color3, Darkest: Color3)
local Alpha = Random:NextNumber(0, 1)
local Color = Lightest:Lerp(Darkest, Alpha)
return Color.R * 255, Color.G * 255, Color.B * 255
end
return function(Entity: Server.entity)
local Head: Part = Entity.Character:WaitForChild("Head")
local Models: Configuration = Entity.Character:WaitForChild("models")
local Humanoid: Humanoid = Entity.Character:WaitForChild("Humanoid")
local HumanoidRootPart: Part = Entity.Character:WaitForChild("HumanoidRootPart")
local Accessories = {}
local Description = nil
local Success, Err = pcall(function()
Description = Server.Service.Players:GetCharacterAppearanceInfoAsync(Entity.Player.UserId)
end)
if not Description then
repeat
Success, Err = pcall(function()
Description = Server.Service.Players:GetCharacterAppearanceInfoAsync(Entity.Player.UserId)
end); task.wait()
until Success
end
local Race = Server.Utilities:getRandomItem(Races)
warn(Race)
local SkinColor = GetSkinColor(Race)
local R, G, B = GetColorWeighted(Race)
local HairColor = Color3.fromRGB(R, G, B)
if Success and Description and Description.assets then
for _, Asset in Description.assets do
if Asset.assetType.id == 41 then
table.insert(Accessories, {Id = Asset.id, Data = Asset.assetType})
end
end
end
if Humanoid then
for I, AccessoryData in Accessories do
local Model = Server.Service.InsertService:LoadAsset(AccessoryData.Id)
local Accessory: Accessory = Model:FindFirstChildOfClass("Accessory")
Accessory.Name = AccessoryData.Id
local Handle: BasePart = Accessory:FindFirstChild('Handle')
Handle.Color = HairColor; Handle:SetAttribute("no_color", true)
local SpecialMesh = Handle:FindFirstChildOfClass('SpecialMesh') or Handle:FindFirstChild("Mesh")
SpecialMesh.TextureId = "";
for Face, TextureId in pairs(TextureIds) do
local Texture = Instance.new("Texture"); Texture.Color3 = HairColor
Texture.Face = Face; Texture.Texture = TextureId; Texture.Parent = Handle
end; Accessory.Parent = Entity.Character; Accessory.AccessoryType = Enum.AccessoryType.Hair
Model:Destroy()
end
end
local Gender = math.random(1, 2) == 2 and "Male" or "Female"
local Clothing = Server.Clothing.Male:GetChildren()
local Selected = Clothing[math.random(1, #Clothing)]
local Shirt: Shirt = Selected.Shirt:Clone()
Shirt.Parent = Entity.Character
local Pants: Pants = Selected.Pants:Clone()
Pants.Parent = Entity.Character
local EyeRaceFolder = Race == "Fanalis" and "Fanalis" or "Human"
local EyesFolder = Server.Decals.Faces.Eyes[Gender][EyeRaceFolder]:GetChildren()
local SelectedEye = EyesFolder[math.random(1, #EyesFolder)]
local Iris = SelectedEye.Iris:Clone()
Iris.Name = "Iris"; Iris.Parent = Entity.Character:FindFirstChild("mock", true)
Iris.Color3 = Color3.fromRGB(math.random(255), math.random(255), math.random(255))
local Sclera = SelectedEye.Sclera:Clone()
Sclera.Parent = Entity.Character:FindFirstChild("mock", true)
Sclera.Name = "Sclera"
local Eyebrow: Decal = Server.Decals.Faces.Eyebrows:GetChildren()[math.random(#Server.Decals.Faces.Eyebrows:GetChildren())]:Clone()
Eyebrow.Parent = Entity.Character:FindFirstChild("mock", true); Eyebrow.Name = "Eyebrow"; Eyebrow.Color3 = HairColor
local Mouth: Decal = Server.Decals.Faces.Mouths:GetChildren()[math.random(#Server.Decals.Faces.Mouths:GetChildren())]:Clone()
Mouth.Parent = Entity.Character:FindFirstChild("mock", true); Mouth.Name = "Mouth";
local Nose: Decal = Server.Decals.Faces.Noses:GetChildren()[math.random(#Server.Decals.Faces.Noses:GetChildren())]:Clone()
Nose.Parent = Entity.Character:FindFirstChild("mock", true); Nose.Name = "Nose";
if Gender == "Female" then
local GirlTorso: CharacterMesh = Server.Models.Female:Clone(); GirlTorso.Parent = Entity.Character
end
Humanoid.DisplayName = `{Names[Gender][math.random(1, #Names[Gender])]} {Names.LastNames[math.random(1, #Names.LastNames)]}`
if Race == "Piglin" then
Mouth:Destroy(); Nose:Destroy()
Sclera.Color3 = Color3.fromRGB(0, 0, 0)
Iris.Color3 = Color3.fromRGB(255, 217, 29)
local PiglinNose = Server.Models.Race.Piglin.Nose:Clone()
PiglinNose.main.Head.Part1 = Entity.Character.Head; PiglinNose.Parent = Models
local Ears = Server.Models.Race.Human.Ears:Clone()
Ears.left.Head.Part0 = Entity.Character.Head; Ears.right.Head.Part0 = Entity.Character.Head; Ears.Parent = Models
elseif Race == "Vista" then
local Ears = Server.Models.Race.Vista.Ears:Clone()
Ears.main.Head.Part1 = Entity.Character.Head; Ears.Parent = Models
elseif Race == "Human" then
local Ears = Server.Models.Race.Human.Ears:Clone()
Ears.left.Head.Part0 = Entity.Character.Head; Ears.right.Head.Part0 = Entity.Character.Head; Ears.Parent = Models
elseif Race == "Fanalis" then
Iris.Color3 = math.random(1, 2) == 2 and Color3.fromRGB(255, 131, 158) or Color3.fromRGB(97, 30, 40)
local Piercing = Server.Decals.Faces.Markings.Piercing:Clone()
Piercing.Parent = Entity.Character:FindFirstChild("mock", true)
elseif Race == "Imuchakk" then
Iris.Color3 = math.random(1, 2) == 2 and Color3.fromRGB(255, 165, 69) or Color3.fromRGB(193, 127, 52)
local Ears = Server.Models.Race.Human.Ears:Clone()
Ears.left.Head.Part0 = Entity.Character.Head; Ears.right.Head.Part0 = Entity.Character.Head; Ears.Parent = Models
elseif Race == "Dragonkin" then
local R2, G2, B2 = LerpColors(Color3.fromRGB(255, 255, 255), Color3.fromRGB(86, 77, 58))
local Horn = Server.Models.Race.Dragonkin[`Horn{math.random(5)}`]:Clone(); Horn.Parent = Models
Horn.main.Head.Part1 = Entity.Character.Head; Horn.main.SurfaceAppearance.Color = Color3.fromRGB(R2, G2, B2)
local Ears = Server.Models.Race.Human.Ears:Clone()
Ears.left.Head.Part0 = Entity.Character.Head; Ears.right.Head.Part0 = Entity.Character.Head; Ears.Parent = Models
end
for _, Part in Entity.Character:GetDescendants() do
if Part:IsA('BasePart') and Part.Name ~= 'HumanoidRootPart' and not Part:GetAttribute('no_color') then
if typeof(SkinColor) ~= "BrickColor" then
Part.Color = SkinColor
else
Part.BrickColor = SkinColor
end;
end
end
endEditor is loading...
Leave a Comment