Advertisement
HowToRoblox

CustomizeHandler

Feb 17th, 2021
1,083
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.15 KB | None | 0 0
  1. local enterId = script.Parent:WaitForChild("EnterId")
  2. local enterColour = script.Parent:WaitForChild("EnterColour")
  3.  
  4. local removeHats = script.Parent:WaitForChild("RemoveHats")
  5.  
  6. local partColours = script.Parent:WaitForChild("PartColourSelector"):GetChildren()
  7.  
  8. local selectedPart = nil
  9.  
  10.  
  11. for i, partColour in pairs(partColours) do
  12.    
  13.     partColour.MouseButton1Click:Connect(function()
  14.        
  15.         selectedPart = partColour.Name
  16.     end)
  17. end
  18.  
  19.  
  20. enterColour.FocusLost:Connect(function(enterPressed)
  21.    
  22.     if enterPressed then
  23.        
  24.         local text = enterColour.Text
  25.         local textNoSpaces = string.gsub(text, " ", "")
  26.        
  27.         local splitText = string.split(textNoSpaces, ",")
  28.        
  29.         local rgb = Color3.fromRGB(splitText[1], splitText[2], splitText[3])
  30.        
  31.        
  32.         if selectedPart then
  33.            
  34.             game.ReplicatedStorage.OnColourChanged:FireServer(rgb, selectedPart)
  35.         end
  36.     end
  37. end)
  38.  
  39.  
  40. enterId.FocusLost:Connect(function(enterPressed)
  41.    
  42.     if enterPressed then
  43.        
  44.         local id = enterId.Text
  45.        
  46.         game.ReplicatedStorage.OnAssetInserted:FireServer(id)
  47.     end
  48. end)
  49.  
  50.  
  51. removeHats.MouseButton1Click:Connect(function()
  52.    
  53.     game.ReplicatedStorage.OnHatsRemoved:FireServer()
  54. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement