Advertisement
HowToRoblox

CustomizeApplier

Feb 17th, 2021
1,108
1
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.32 KB | None | 1 0
  1. game.ReplicatedStorage.OnColourChanged.OnServerEvent:Connect(function(plr, rgb, selectedPart)
  2.    
  3.    
  4.     local char = plr.Character
  5.     local bc = char:WaitForChild("Body Colors")
  6.    
  7.    
  8.     if selectedPart == "All" then
  9.  
  10.         bc.HeadColor3, bc.LeftArmColor3, bc.RightArmColor3, bc.TorsoColor3, bc.LeftLegColor3, bc.RightLegColor3 = rgb, rgb, rgb, rgb, rgb, rgb
  11.        
  12.        
  13.     else
  14.         bc[selectedPart] = rgb
  15.     end
  16. end)
  17.  
  18.  
  19. game.ReplicatedStorage.OnAssetInserted.OnServerEvent:Connect(function(plr, id)
  20.    
  21.     local char = plr.Character
  22.    
  23.     pcall(function()
  24.  
  25.         local model = game:GetService("InsertService"):LoadAsset(id)
  26.        
  27.         for i, child in pairs(model:GetChildren()) do
  28.            
  29.            
  30.             if child:IsA("Accessory") or child:IsA("ShirtGraphic") then
  31.                
  32.                 child.Parent = char
  33.                
  34.                
  35.             elseif child:IsA("Shirt") then
  36.                
  37.                 char.Shirt:Destroy()
  38.                 child.Parent = char
  39.                
  40.                
  41.             elseif child:IsA("Pants") then
  42.                
  43.                 char.Pants:Destroy()
  44.                 child.Parent = char
  45.                
  46.                
  47.             elseif child:IsA("Decal") then
  48.                
  49.                 char.Head.face:Destroy()
  50.                 child.Parent = char.Head
  51.             end
  52.         end
  53.     end)
  54. end)
  55.  
  56.  
  57. game.ReplicatedStorage.OnHatsRemoved.OnServerEvent:Connect(function(plr)
  58.    
  59.     local char = plr.Character
  60.    
  61.     for i, child in pairs(char:GetChildren()) do
  62.        
  63.         if child:IsA("Accessory") then child:Destroy() end
  64.     end
  65. end)
Advertisement
Comments
Add Comment
Please, Sign In to add comment
Advertisement