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

How do you chage players hair using a script?

I need help changing the players hair while inside the sphere or close after. I am making a DBZ game and need help changing the players hair. Another thing I should mention is that I am using a StarterCharacter in StarterPlayer if that makes a difference.

local p = game.Players.LocalPlayer --Get the localplayer
local char = p.Character

function onKeyPress(inputObject, gameProcessedEvent)
    if inputObject.KeyCode == Enum.KeyCode.X then
         local part = Instance.new("Part", workspace)
  part.CanCollide = false
  part.Anchored = true
  part.Position = p.Character.HumanoidRootPart.Position 
  part.BrickColor = BrickColor.new("New Yeller")
  part.Shape = "Ball"  
  part.formFactor = 'Symmetric'
  part.Size = Vector3.new(10, 10, 10)
  part.TopSurface = 0
  part.BottomSurface = 0
   part.Transparency = part.Transparency + 0.1 
	wait (0.05)
	part.Transparency = part.Transparency + 0.1
	wait (0.05)
	part.Transparency = part.Transparency + 0.1
	wait (0.05)
	part.Transparency = part.Transparency + 0.1 
	wait (0.05)
	part.Transparency = part.Transparency + 0.1 
	wait (0.05)
	part.Transparency = part.Transparency + 0.1 
	wait (0.05)
	part.Transparency = part.Transparency + 0.1
	wait (0.05)
	part.Transparency = part.Transparency + 0.1
	wait (0.05)
	part.Transparency = part.Transparency + 0.1 
	wait (0.05)
	part.Transparency = part.Transparency + 0.1 
	wait (0.05)
	 Tshirt "rbxassetid://451267133"
    end

end

game:GetService("UserInputService").InputBegan:connect(onKeyPress)

3 comments

0

AddAccessory() is the way to go when adding accessories like hair. But if you want to change your hair you need to locate the accessory get it’s type so you know if it’s hair and change the mesh id inside of the Handle. (unless the handle is somehow a MeshPart)

0

Thank You Guys

1 answer

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