You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
What I am trying to do is keep the clothing on the player. They are welded to the player in startercharacter. -
What is the issue? Include screenshots / videos if possible!
Our issue is that when a player respawns they loose their clothing and if they do have clothing it seems to be on the client only even though the respawn and stuff is on server.
-
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I’ve tried all types of things like attachments, weld constraints, welds, manual welds etc. Yeah i looked for some, they kept saying its like a bug with welds.
this is what the startercharacter looks like.
--//Code for Loading Player's Customization Data
local rp = game:GetService("ReplicatedStorage")
local DataRemote = rp:WaitForChild("Data")
local Clothing = rp:WaitForChild("Clothing")
--//Storage of hairs and Races
local Hairs = rp:WaitForChild("Hairs")
local Races = rp:WaitForChild("Races")
--//Colors and stuff
local hairColors = {Color3.fromRGB(79, 79, 79),Color3.fromRGB(0, 0, 0),Color3.fromRGB(255, 255, 255),Color3.fromRGB(255, 0, 0),Color3.fromRGB(0, 0, 255),Color3.fromRGB(255, 255, 0),Color3.fromRGB(255, 102, 0),Color3.fromRGB(128, 0, 128),Color3.fromRGB(0, 255, 0),Color3.fromRGB(128, 0, 0)}
local humanSkins = {Color3.fromRGB(255, 204, 153),Color3.fromRGB(229, 194, 152),Color3.fromRGB(228, 185, 142),Color3.fromRGB(217, 145, 100),Color3.fromRGB(204, 132, 67),Color3.fromRGB(199, 122, 88),Color3.fromRGB(190, 114, 60),Color3.fromRGB(68, 0, 0)}
local demonSkins = {Color3.fromRGB(231, 231, 236),Color3.fromRGB(255, 255, 153),Color3.fromRGB(204, 255, 255),Color3.fromRGB(51, 51, 0),Color3.fromRGB(255, 204, 0),Color3.fromRGB(128, 0, 128),Color3.fromRGB(204, 255, 204),Color3.fromRGB(153, 51, 102),Color3.fromRGB(153, 51, 102),Color3.fromRGB(255, 0, 0)}
local eyeColors = {Color3.fromRGB(0, 0, 0),Color3.fromRGB(255, 0, 0),Color3.fromRGB(204, 255, 255),Color3.fromRGB(255, 255, 0),Color3.fromRGB(255, 0, 255),Color3.fromRGB(0, 128, 128),Color3.fromRGB(153, 51, 0),Color3.fromRGB(255, 153, 204)}
local faces = {
["Face1"] = {["Eyebrows"] = "rbxassetid://4119806216", ["Eye"] = "rbxassetid://4453008215", ["Face"] = "rbxassetid://4399351941" },
["Face2"] = {["Eyebrows"] = "rbxassetid://4119859420", ["Eye"] = "rbxassetid://4418208019", ["Face"] = "rbxassetid://4418161782" },
["Face3"] = {["Eyebrows"] = "rbxassetid://4119859420", ["Eye"] = "rbxassetid://4499969643", ["Face"] = "rbxassetid://4499965807" },
["Face4"] = {["Eyebrows"] = "rbxassetid://4119859420", ["Eye"] = "rbxassetid://4459202818", ["Face"] = "rbxassetid://4459186642" },
["Face5"] = {["Eyebrows"] = "rbxassetid://4455160018", ["Eye"] = "rbxassetid://4477794185", ["Face"] = "rbxassetid://4477783164" }
}
local Storage = script:WaitForChild("Storage")
game.Players.PlayerAdded:Connect(function(Player)
DataRemote:FireClient(Player)
Player.CharacterAdded:Connect(function(Character)
DataRemote:FireClient(Player)
end)
end)
DataRemote.OnServerEvent:Connect(function(Player,DataToLoad)
local Character = Player.Character
--//Player Customization Data
local CustomizationData = Instance.new("Folder",Player)
CustomizationData.Name = "CustomizationData"
for i, fold in pairs(Storage:GetChildren()) do
local folder = fold:Clone()
folder.Parent = CustomizationData
end
--//Load Data
for i, fold in pairs(CustomizationData:GetChildren()) do
for j, data in pairs(fold:GetChildren()) do
if data:IsA("StringValue") then
data.Value = DataToLoad[i][j]
elseif data:IsA("Color3Value") then
local R
local G
local B
for k=1, 3 do
if k==1 then
R = tonumber(DataToLoad[i][j][k])
elseif k==2 then
G = tonumber(DataToLoad[i][j][k])
elseif k==3 then
B = tonumber(DataToLoad[i][j][k])
end
end
print(R,G,B)
data.Value = Color3.fromRGB(R,G,B)
end
end
end
local Assets = CustomizationData:WaitForChild("Assets")
local Colors = CustomizationData:WaitForChild("Colors")
--//Race Handler
local Race = Assets:FindFirstChild("Race")
if Race then
if Race.Value == "Human" then
--//Making new Character for player to load as
local newChar = Races.Human:Clone()
newChar.Name = "StarterCharacter"
--//Removes previous startercharacter
game.StarterPlayer.StarterCharacter:Destroy()
--//Parents the newChar to StarterCharacter
newChar.Parent = game.StarterPlayer
--//Reloads Character
Player:LoadCharacter()
Character = Player.Character
--//Remove is after character loads to prevent any overlap with other players
--
--use HSkin
local skinColor = Colors:FindFirstChild("HSkin")
if skinColor then
local r = math.floor(skinColor.Value.r * 255)
local g = math.floor(skinColor.Value.g * 255)
local b = math.floor(skinColor.Value.b * 255)
local newColor = Color3.fromRGB(r,g,b)
for l, m in pairs(Character:GetChildren()) do
if m:IsA("MeshPart") or m:IsA("Part") then
m.Color = newColor
end
end
end
elseif Race.Value == "Demon" then
--//Making new Character for player to load as
local newChar = Races.Demon:Clone()
newChar.Name = "StarterCharacter"
--//Removes previous startercharacter
game.StarterPlayer.StarterCharacter:Destroy()
--//Parents the newChar to StarterCharacter
newChar.Parent = game.StarterPlayer
--//Reloads Character
Player:LoadCharacter()
Character = Player.Character
--//Remove is after character loads to prevent any overlap with other players
--
--use DSkin
local skinColor = Colors:FindFirstChild("DSkin")
if skinColor then
local r = math.floor(skinColor.Value.r * 255)
local g = math.floor(skinColor.Value.g * 255)
local b = math.floor(skinColor.Value.b * 255)
local newColor = Color3.fromRGB(r,g,b)
for l, m in pairs(Character:GetChildren()) do
if m:IsA("MeshPart") or m:IsA("Part") then
m.Color = newColor
--[==[local Horn = m:FindFirstChild("horn")
if Horn then
Horn.Color = newColor
end]==]
end
end
end
end
end
--//Asset Handler
for i, v in pairs(Assets:GetChildren()) do
local Head = Character:FindFirstChild("Head")
if v.Name == "Hair" then
local Hair = Hairs:FindFirstChild(v.Value):Clone()
if Hair then
--//Removes Preset Hair
for j,k in pairs(Character:GetChildren()) do
if string.match(k.Name,"Hair") then
k:Destroy()
end
end
--//Parents Saved Hair
Hair.Parent = Character
local HairColor = Colors:FindFirstChild("HairC")
if HairColor then
local r = math.floor(HairColor.Value.r * 255)
local g = math.floor(HairColor.Value.g * 255)
local b = math.floor(HairColor.Value.b * 255)
local newColor = Color3.fromRGB(r,g,b)
Hair.Handle.Color = newColor
Head.eyebrow.Color3 = newColor
end
end
elseif v.Name == "Face" then
local Head = Character:FindFirstChild("Head")
if Head then
--//Loading Face
Head.eye.Texture = faces[v.Value]["Eye"]
Head.eyebrow.Texture = faces[v.Value]["Eyebrows"]
Head.face.Texture = faces[v.Value]["Face"]
--//Loading Eye Color
local eyeColor = Colors:FindFirstChild("EyesC")
if eyeColor then
local r = math.floor(eyeColor.Value.r * 255)
local g = math.floor(eyeColor.Value.g * 255)
local b = math.floor(eyeColor.Value.b * 255)
local newColor = Color3.fromRGB(r,g,b)
Head.eye.Color3 = newColor
end
end
end
end
for i, v in pairs(Character:GetChildren()) do
if v:IsA("Part") or v:IsA("MeshPart") then
if v.Name == "LowerTorso" then
local cloth = Clothing:FindFirstChild(v.Name)
if cloth then
cloth:Clone()
cloth.Parent = v
cloth.LowerTorso.CFrame = v.CFrame
local weld = Instance.new("ManualWeld")
weld.Part0 = cloth.LowerTorso
weld.Part1 = v
weld.C0 = weld.Part0.CFrame:inverse() * weld.Part1.CFrame
weld.Parent = weld.Part0
end
else
local cloth = Clothing:FindFirstChild(v.Name)
if cloth then
cloth:Clone()
cloth.Parent = v
cloth.CFrame = v.CFrame
local weld = Instance.new("ManualWeld")
weld.Part0 = cloth
weld.Part1 = v
weld.C0 = weld.Part0.CFrame:inverse() * weld.Part1.CFrame
weld.Parent = weld.Part0
end
end
end
end
end)
if you have any idea why the clothing doesn’t spawn please let me know, Thanks in advance!