Advertisement
Guest User

Untitled

a guest
Aug 25th, 2019
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.54 KB | None | 0 0
  1. 1. Add Folder name it Event and in it create remote event in ReplicatedStorage name it HairEvent1
  2. 2. Create Folder in ReplicatedStorage name it Hair and put your Hair inside and name it Hair1 -- First Hair
  3.                                                                                         Hair2 -- Second Hair etc
  4. AND DONT FORGET TO CHANGE EVENTS AND HAIR NUMBER WHEN ADDING NEW HAIR!!!!
  5. --
  6. Local Script in Button which will equip the haird
  7. --
  8. script.Parent.MouseButton1Click:Connect(function()
  9.     game.ReplicatedStorage.Events.HairEvent1:FireServer()
  10. end)
  11. -----
  12. Create another script in ServerScriptService put this code inside
  13. ----
  14. while true do
  15. wait(0.1)
  16. local w = game.Workspace:GetChildren()
  17. for i=1, #w do
  18. c = w[i]:GetChildren()
  19. for i=1, #c do
  20. if (c[i].className == "Accesory") then
  21. c[i]:remove()
  22. end
  23. end
  24. end
  25. end
  26. -------------------
  27. Put this in ServerScriptService (or in your script)
  28. --------------------
  29. game.ReplicatedStorage.Events.HairEvent1.OnServerEvent:Connect(function(plr) -- change event if u have other
  30.    
  31.     local Storage = game.ReplicatedStorage.Hair.Hair1 -- change name if u want
  32.     local char = plr.Character
  33.    
  34.     if char:FindFirstChild("Humanoid") then
  35.        
  36.         local Folder = char.Head.Hair
  37.         Folder:ClearAllChildren()
  38.        
  39.         local Head = char.Head
  40.         local New_Hair = Storage:Clone()
  41.        
  42.         New_Hair.Parent = Folder
  43.         New_Hair.Position = Head.Position
  44.         local Weld = Instance.new("Weld")
  45.         Weld.Parent = New_Hair
  46.         Weld.Part0,Weld.Part1 = Head, New_Hair
  47.         Weld.C0 = CFrame.new(0,0.8,0) -- change if your hair isnt on right place
  48.         Weld.C1 = Head.HairAttachment.CFrame
  49.        
  50. end
  51. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement