You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve?
A character spawns with custom bodycolors, different shirt, pants, face texture. -
What is the issue?
The player spawns fine in roblox studio, going into first person doesn’t do anything, but in roblox itself the player loads differently(Sometimes naked, sometimes with clothes but with default face, even tho it’s texture is 0), going into firstperson and back makes it turn into gray, if different player joins in, character gets dyed into their skin color (even tho it doesn’t change for the player that joined) -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
Tried deleting and creating shirts and pants, changing their texture in the game via F9 console, printing the ShirtTemplate id’s and Face.Texture, everything’s fine except how the character looks for client.
Here I provide to you gifs with what’s happening.
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
local function spawnPlayer(Player)
repeat task.wait() until busySpawning == false
print('I am trying some data thingies')
busySpawning = true
warn('Got the connection from '..Player.Name)
game.StarterGui.Blackout:Clone().Parent = Player.PlayerGui
-- Blackout Tweens
local Tween = TS:Create(Player.PlayerGui:WaitForChild('Blackout').Frame, tweenInfo, {BackgroundTransparency = 0})
local TweenReverse = TS:Create(Player.PlayerGui:FindFirstChild('Blackout').Frame, tweenInfo2, {BackgroundTransparency = 1})
local textTween = TS:Create(Player.PlayerGui:FindFirstChild('Blackout'):WaitForChild('textFrame'):WaitForChild('TextLabel'), tweenInfo, {TextTransparency = 0})
local textTweenReverse = TS:Create(Player.PlayerGui:FindFirstChild('Blackout'):FindFirstChild('textFrame'):FindFirstChild('TextLabel'), tweenInfo2, {TextTransparency = 1})
local TextGUI = Player.PlayerGui:FindFirstChild('Blackout'):FindFirstChild('textFrame'):FindFirstChild('TextLabel')
--Tween:Play()
--Tween.Completed:Wait()
--TextGUI.Text = "<i>Getting your Data...</i>"
--textTween:Play()
local colorBody
local colorHair
local newCH -- newColorHair
local newCB -- newColorBody
local Data
local playerID = 'Player_'..Player.UserId
playerData = {
[playerID] = {};
}
local success, errorMessage = pcall(function()
Data = DS:GetAsync(playerID)
end)
if success then
print('I have got data of '..Player.Name, Data)
else
warn(errorMessage)
end
if Data then -- IF there are some stored colors then get them, else save new ones.
if Data['HairColor'] or Data['BodyColor'] then
colorHair = Color3.fromRGB(Data['HairColor'][1], Data['HairColor'][2], Data['HairColor'][3])
colorBody = Color3.fromRGB(Data['BodyColor'][1], Data['BodyColor'][2], Data['BodyColor'][3])
end
TextGUI.Text = "Hello, "..Player.Name
task.wait(0.3)
else
TextGUI.Text = "Haven't seen you before, "..Player.Name
task.wait(0.3)
newCH = {
math.random(0,255);
math.random(0,255);
math.random(0,255)
}
newCB = {
math.random(0,255);
math.random(0,255);
math.random(0,255)
}
colorHair = Color3.fromRGB(newCH[1], newCH[2], newCH[3])
colorBody = Color3.fromRGB(newCB[1], newCB[2], newCB[3])
playerData = {
[playerID] = {
['BodyColor'] = {
newCB[1];
newCB[2];
newCB[3];
};
['HairColor'] = {
newCH[1];
newCH[2];
newCH[3];
}
}
}
local success, errorMessage = pcall(function()
DS:SetAsync(playerID, playerData[playerID])
end)
if success then
print('I have saved colors for new player, his name is ',Player.Name)
else
warn(errorMessage)
end
end
TextGUI.Text = "Preparing the Stage."
local loadingCompleted = false
RS.EventsAndFunctions.Loading:FireClient(Player)
local connection = RS.EventsAndFunctions.Loading.OnServerEvent:Connect(function(PlayerThatSent)
if Player.Name == PlayerThatSent.Name then
loadingCompleted = true
end
end)
repeat task.wait() until loadingCompleted == true
TextGUI.Text = "Creating your Toy."
-- Humanoid description
local Accessories = Players:GetHumanoidDescriptionFromUserId(Player.UserId):GetAccessories(true)
local humanoidDescription = Instance.new('HumanoidDescription', RS)
humanoidDescription.Name = "humanoidDescription"..Player.UserId
humanoidDescription:SetAccessories(Accessories, true)
humanoidDescription.HeadColor = colorBody
humanoidDescription.TorsoColor = colorBody
humanoidDescription.LeftArmColor = colorBody
humanoidDescription.LeftLegColor = colorBody
humanoidDescription.RightLegColor = colorBody
humanoidDescription.RightArmColor = colorBody
humanoidDescription.Shirt = 699451328
humanoidDescription.Pants = 591385692
Player:LoadCharacterWithHumanoidDescription(humanoidDescription)
Player.CharacterAppearanceLoaded:Wait()
local character = Player.Character
local Humanoid = character:WaitForChild('Humanoid')
local Animator = Humanoid:WaitForChild('Animator')
-- Trigger a simple change in the object (add an underscore to the name)
Tween = TS:Create(Player.PlayerGui:WaitForChild('Blackout').Frame, tweenInfo, {BackgroundTransparency = 0})
TweenReverse = TS:Create(Player.PlayerGui:FindFirstChild('Blackout').Frame, tweenInfo2, {BackgroundTransparency = 1})
textTween = TS:Create(Player.PlayerGui:FindFirstChild('Blackout'):WaitForChild('textFrame'):WaitForChild('TextLabel'), tweenInfo, {TextTransparency = 0})
textTweenReverse = TS:Create(Player.PlayerGui:FindFirstChild('Blackout'):FindFirstChild('textFrame'):FindFirstChild('TextLabel'), tweenInfo2, {TextTransparency = 1})
TextGUI = Player.PlayerGui:FindFirstChild('Blackout'):FindFirstChild('textFrame'):FindFirstChild('TextLabel')
--textTween:Play()
--Tween:Play()
-- WeaponGrip
local RArmWeaponGrip = Instance.new('Part')
RArmWeaponGrip.Size = Vector3.new(0.5, 0.5, 0.5)
RArmWeaponGrip.Name = "PartGripAttachment"
RArmWeaponGrip.Parent = character:WaitForChild('Right Arm')
RArmWeaponGrip.Transparency = 0
RArmWeaponGrip.Massless = true
RArmWeaponGrip.CanCollide = false
RArmWeaponGrip.CanTouch = false
RArmWeaponGrip.CanQuery = false
-- Animateable weapon grip
local WC = Instance.new('Motor6D')
WC.Name = 'Motor6DGripArm'
WC.Part0 = character:FindFirstChild('Right Arm')
WC.Part1 = RArmWeaponGrip
WC.Parent = character:FindFirstChild('Right Arm')
-- Required to be below Motor6D code lines
RArmWeaponGrip.Position = character:WaitForChild('Right Arm').Position - Vector3.new(0, character:WaitForChild('Right Arm').Size.Y / 2, 0)
RArmWeaponGrip.Rotation = Vector3.new(-90, 90, 0)
RArmWeaponGrip.Transparency = 1
-- NameGUI (idk if that's necessary yet...)
local Name = RS.NameGui:Clone()
Name.Parent = character
Name.GuildText.Visible = false
Name.NameText.Text = character.Name
Name.Adornee = character:WaitForChild('HumanoidRootPart')
Name.PlayerToHideFrom = Player
-- Outline Status effects.
local Highlight = RS.Outline:Clone()
Highlight.Parent = character
Highlight.Adornee = character
TextGUI.Text = "Painting your Toy."
-- The Attributes
Player:SetAttribute('Spawned', false)
if Data then
Player:SetAttribute('HairColorR', Data['HairColor'][1])
Player:SetAttribute('HairColorG', Data['HairColor'][2])
Player:SetAttribute('HairColorB', Data['HairColor'][3])
Player:SetAttribute('BodyColorR', Data['BodyColor'][1])
Player:SetAttribute('BodyColorG', Data['BodyColor'][2])
Player:SetAttribute('BodyColorB', Data['BodyColor'][3])
else
Player:SetAttribute('HairColorR', newCH[1])
Player:SetAttribute('HairColorG', newCH[2])
Player:SetAttribute('HairColorB', newCH[3])
Player:SetAttribute('BodyColorR', newCB[1])
Player:SetAttribute('BodyColorG', newCB[2])
Player:SetAttribute('BodyColorB', newCB[3])
end
--
TextGUI.Text = "Making Toy Playable."
Humanoid:SetAttribute('BaseSpeed', 16)
Humanoid:SetAttribute('countCombo', 0)
Humanoid:SetAttribute('Running', false)
Humanoid:SetAttribute('Dashing', false)
Humanoid:SetAttribute('Stunned', 0)
Humanoid:SetAttribute('Debounce', 0)
Humanoid:SetAttribute('isTalking', false)
Humanoid:SetAttribute('Ragdolled', false)
Humanoid:SetAttribute('Blocking', false)
Humanoid:SetAttribute('Saturation', 0)
Humanoid:SetAttribute('HPRegeneration', 1/180)
Humanoid:SetAttribute('Quests', 'None')
TextGUI.Text = "Giving your Data to the Toy."
-- Give necessary data such as Quests or Values that are needed at start
if Data then
-- Class
if Data['Class'] and Data['Class'] ~= nil then
Humanoid:SetAttribute('Class', Data['Class'])
for _, weapon in pairs(RS.Tools:WaitForChild(Data['Class']):GetChildren()) do
if not weapon:IsA('Tool') then return end
local giveToPlayer = weapon:Clone()
giveToPlayer.Parent = Player.Backpack
end
else
Data['Class'] = "Sword"
Humanoid:SetAttribute('Class', Data['Class'])
for _, weapon in pairs(RS.Tools:WaitForChild(Data['Class']):GetChildren()) do
if not weapon:IsA('Tool') then return end
local giveToPlayer = weapon:Clone()
giveToPlayer.Parent = Player.Backpack
end
end
-- Quest
if Data['Quests'] then
Humanoid:SetAttribute('Quests', Data['Quests'])
if table.find(string.split(Humanoid:GetAttribute('Quests'), ","), 'Bandage') then -- if Bandage quest is completed destroy the NPC
print('Found bandage quest')
local Destroyer = game.Workspace.Edenic["The House"].Upstairs.Edenaxic:FindFirstChild('Destroyer'):Clone()
Destroyer.Parent = character
Destroyer.Enabled = true
local keyTool = RS.Tools["Key..?"]:Clone()
keyTool.Parent = Player.Backpack
end
else
Data['Quests'] = "nil"
Humanoid:SetAttribute('Quests', "nil")
end
if Data['Quiz'] then
Data['Quiz'] = false
end
else
Data = {
['HairColor'] = playerData[playerID]['HairColor'];
['BodyColor'] = playerData[playerID]['BodyColor'];
['Quests'] = "nil";
['Class'] = "Sword";
['Quiz'] = false;
}
Humanoid:SetAttribute('Quests', "nil")
Humanoid:SetAttribute('Class', "Sword")
for _, weapon in pairs(RS.Tools:WaitForChild(Data['Class']):GetChildren()) do
if not weapon:IsA('Tool') then return end
local giveToPlayer = weapon:Clone()
giveToPlayer.Parent = Player.Backpack
end
end
--
playerData = {
[playerID] = {
['Class'] = Data['Class'];
['BodyColor'] = {
Data['BodyColor'][1];
Data['BodyColor'][2];
Data['BodyColor'][3];
};
['HairColor'] = {
Data['HairColor'][1];
Data['HairColor'][2];
Data['HairColor'][3];
};
['Quests'] = Data['Quests'];
['Quiz'] = Data['Quiz'];
};
}
print('Started loading head and hair for '..Player.Name)
task.wait(2)
-- Destroy any characterMeshes (bodymodifications) and accessories
for _, v in pairs(character:GetChildren()) do
if v:IsA('CharacterMesh') then
v:Destroy()
elseif v:IsA('Accessory') then
if not v:FindFirstChild('Handle'):FindFirstChild('HairAttachment') then
v:Destroy()
else
if v:FindFirstChild('Handle') or v:FindFirstChild('Handle'):FindFirstChild('HairAttachment') then
for _, m in pairs(v:FindFirstChild('Handle'):GetChildren()) do
if m:IsA('SpecialMesh') or m:IsA('MeshPart') or m.Name == "Mesh" or m.Name == "SpecialMesh" then
m.TextureId = ""
m.Parent.Color = colorHair
end
end
end
end
end
end
TextGUI.Text = "Toy's at Barbershop."
--
Humanoid.HealthDisplayType = Enum.HumanoidHealthDisplayType.AlwaysOff
Humanoid.NameDisplayDistance = 0
Humanoid.DisplayDistanceType = Enum.HumanoidDisplayDistanceType.None
Humanoid.AutoJumpEnabled = false
--
local hitbox = RS.Hitbox
local hitboxOnCharacter = hitbox:Clone()
hitboxOnCharacter.Parent = character
hitboxOnCharacter.Position = character:FindFirstChild('HumanoidRootPart').Position
local weld = Instance.new('Weld')
weld.Name = "HitboxWeld"
weld.Parent = character
weld.Part0 = hitboxOnCharacter
weld.Part1 = character.HumanoidRootPart
hitboxOnCharacter.Rotation = hitboxOnCharacter.Rotation + Vector3.new(0, 90, 0)
--
--character:FindFirstChild('Head').CanCollide = false
-- Specs
--if Player.UserId == 167566631 then -- Ylebahka
-- local keyTool = RS.Tools["Key..?"]:Clone()
-- keyTool.Parent = Player.Backpack
--end
--if Player.UserId == 604738781 then -- Nax
-- local keyTool = RS.Tools["Key..?"]:Clone()
-- keyTool.Parent = Player.Backpack
--end
--if Player.UserId == 105894066 then -- Fin
-- local keyTool = RS.Tools["Key..?"]:Clone()
-- keyTool.Parent = Player.Backpack
--end
--if Player.UserId == 1827742796 then -- Djafoos
-- local keyTool = RS.Tools["Key..?"]:Clone()
-- keyTool.Parent = Player.Backpack
--end
--if Player.UserId == 487837204 then -- Gagroma
-- local keyTool = RS.Tools["Key..?"]:Clone()
-- keyTool.Parent = Player.Backpack
--end
--if Player.UserId == 163363981 then -- Lesha
-- local keyTool = RS.Tools["Key..?"]:Clone()
-- keyTool.Parent = Player.Backpack
--end
TextGUI.Text = "Enjoy."
-- Deleting Shirt/Pants/Face due to how buggy they are, just create new ones
character:FindFirstChild('Head'):FindFirstChildOfClass('Decal'):Destroy()
character:FindFirstChildOfClass('Shirt'):Destroy()
character:FindFirstChildOfClass('Pants'):Destroy()
task.wait(2)
textTweenReverse:Play()
character.Parent = game.Workspace:FindFirstChild('Alive')
local Face = Instance.new('Decal', character:FindFirstChild('Head'))
Face.Name = "Face"
Face.Face = Enum.NormalId.Front
Face.Texture = 0
local Pants = RS:FindFirstChild('Clothing'):FindFirstChild('Default'):FindFirstChild('DefaultP'):Clone()
local Shirt = RS:FindFirstChild('Clothing'):FindFirstChild('Default'):FindFirstChild('DefaultS'):Clone()
Pants.Parent = character
Shirt.Parent = character
--Pants.PantsTemplate = 591385689
--Shirt.ShirtTemplate = 699451302
--character:MoveTo(game.Workspace.Edenic.TeleportTest.Position)
TweenReverse:Play()
Player:SetAttribute('Spawned', true)
Humanoid.WalkSpeed = Humanoid:GetAttribute('BaseSpeed')
connection:Disconnect()
humanoidDescription:Destroy()
busySpawning = false
end
game.Players.PlayerAdded:Connect(function(Player)
spawnPlayer(Player)
end)
respawnCall.OnServerEvent:Connect(function(Player, resetButton)
if (not Player.Character:FindFirstChild('HumanoidRootPart') or resetButton) and Player:GetAttribute('Spawned') == true then
Player:SetAttribute('Spawned', false)
spawnPlayer(Player)
elseif Player.Character.Humanoid.Health >= 1 then
Player:Kick('Unexpected behaviour. Code: 1')
end
end)