Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why wont the hair clone into the players character?

I have no errors, but in my game the hair thats supposed to be cloned won't clone. I dont see any issues with Values and nothing with the names of hats in playerList.

local rs = game.ReplicatedStorage
local hairList = rs.HairList

game.Players.PlayerAdded:Connect(function(plr)

local SetHair = Instance.new("StringValue")
	SetHair.Name = "Hair"
	SetHair.Value = "Bald"
	SetHair.Parent = plr
	
	-- Loading Data

	local success, result = pcall(function()
		Storage:GetAsync(plr.UserId)
	end)
		
	if not success then
		warn(result)
	else
		local LoadArray = Storage:GetAsync(plr.UserId)
		if LoadArray then
			hasCharacter.Value = LoadArray[1]
			SetHair.Value = LoadArray[2]
		end
	end

plr.CharacterAdded:Connect(function(character)

local hairFound = hairList:FindFirstChild(SetHair.Value)
	if hairFound then
		hairFound:Clone().Parent = character -- Clone here.
	end

end)

2 answers

✓ Accepted answer

character.Humanoid:AddAccessory(hairFound:Clone()) should be used instead of cloning and setting the parent to the character

1 comment

0

If it is still not calling for the hair you may also be right with your first answer

The Array doesn't load in time for when the cloning starts making the script think the SetHair is "Bald". All I need to do is add a wait()

This discussion is preserved as it was. New answers, comments, and votes are closed.