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)
You can simply use the AddAccessory method on your humanoid to add the hair to your character. Don't forget however to remove old hair if there is any. Also when the hair has to change back you should delete the hair you're trying to add.
This is the link to the method: https://developer.roblox.com/en-us/api-reference/function/Humanoid/AddAccessory