Advertisement
Guest User

Untitled

a guest
May 26th, 2019
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.90 KB | None | 0 0
  1. function waitForChild(instance, name) if instance:FindFirstChild(name) then return instance:FindFirstChild(name) end
  2. repeat wait() until instance:FindFirstChild(name) return instance:FindFirstChild(name) end
  3. function waitForProperty(instance, name) if instance[name] then return instance[name] end repeat wait() until instance[name] return instance[name] end
  4.  
  5. local mouse = waitForProperty(game:service("Players"), "LocalPlayer"):GetMouse()
  6. local index = waitForProperty(game, "Workspace")
  7. local spectre = waitForChild(script.Parent, "Spectre")
  8. local cursor = waitForChild(spectre, "Cursor")
  9. local preview = waitForChild(index, "Part")
  10. local sat = waitForChild(script.Parent, "Satuation")
  11. local cursor2 = waitForChild(sat, "Cursor")
  12. local isDown = {} -- For dragging purpose.
  13. local data = {{0, 1, 0}, {0, 1, 1}} -- Storing colors.
  14.  
  15. game:service("ContentProvider"):Preload(cursor.Image)
  16.  
  17. local output = waitForChild(script.Parent, "Output")
  18.  
  19. function HSVtoRGB(rawh, rawm, rawv, setColor)
  20.  
  21. local h = ((rawh - spectre.AbsolutePosition.X) / spectre.AbsoluteSize.X)
  22. local v = ((rawv - spectre.AbsolutePosition.Y) / spectre.AbsoluteSize.Y)
  23. local s = 1
  24. local m = (rawm and 1 - ((rawm - sat.AbsolutePosition.Y) / sat.AbsoluteSize.Y)) or 1
  25.  
  26. v = (1 - v) * 2
  27.  
  28. if h > 1 then h = 1 elseif h < 0 then h = 0 end if v > 2 then v = 2 elseif v < 0 then v = 0 end if m > 1 then m = 1 elseif m < 0 then m = 0 end
  29.  
  30. local r, g, b
  31.  
  32. local i = math.floor(h * 6)
  33. local f = h * 6 - i
  34. local p = v * (1 - s)
  35. local q = v * (1 - f * s)
  36. local t = v * (1 - (1 - f) * s)
  37.  
  38. local switch = i % 6
  39. if switch == 0 then
  40. r = v g = t b = p
  41. elseif switch == 1 then
  42. r = q g = v b = p
  43. elseif switch == 2 then
  44. r = p g = v b = t
  45. elseif switch == 3 then
  46. r = p g = q b = v
  47. elseif switch == 4 then
  48. r = t g = p b = v
  49. elseif switch == 5 then
  50. r = v g = p b = q
  51. end
  52.  
  53. r, g, b = math.floor(r * 255), math.floor(g * 255), math.floor(b * 255)
  54.  
  55. if v > 1 then
  56. r = r + (255 - r) * (v - 1)
  57. g = g + (255 - g) * (v - 1)
  58. b = b + (255 - b) * (v - 1)
  59. end
  60.  
  61. if r > 255 then r = 255 end if g > 255 then g = 255 end if b > 255 then b = 255 end
  62.  
  63. sat.BackgroundColor3 = Color3.new(r / 255, g / 255, b / 255)
  64.  
  65. r, g, b = math.floor(128 - (128 - r) * m), math.floor(128 - (128 - g) * m), math.floor(128 - (128 - b) * m)
  66.  
  67. if r > 255 then r = 255 end if g > 255 then g = 255 end if b > 255 then b = 255 end
  68.  
  69. cursor.Position = UDim2.new(h, -5, -(v / 2) + 1, -5)
  70. cursor2.Position = UDim2.new(0, 0, 1 - m, 0)
  71.  
  72. output.Text = tostring(table.concat({r,g,b}, ", "))
  73. game.Players.LocalPlayer.Stats.Character.SkinColor.Value = Color3.new(r/ 255,g/ 255,b/ 255)
  74. if setColor then
  75. game.Players.LocalPlayer.Character:FindFirstChild("Head").BrickColor = BrickColor.new(Color3.new(r/ 255,g/ 255,b/ 255))
  76. game.Players.LocalPlayer.Character:FindFirstChild("UpperTorso").BrickColor = BrickColor.new(Color3.new(r/ 255,g/ 255,b/ 255))
  77. game.Players.LocalPlayer.Character:FindFirstChild("RightUpperLeg").BrickColor = BrickColor.new(Color3.new(r/ 255,g/ 255,b/ 255))
  78. game.Players.LocalPlayer.Character:FindFirstChild("RightUpperArm").BrickColor = BrickColor.new(Color3.new(r/ 255,g/ 255,b/ 255))
  79. game.Players.LocalPlayer.Character:FindFirstChild("RightLowerLeg").BrickColor = BrickColor.new(Color3.new(r/ 255,g/ 255,b/ 255))
  80. game.Players.LocalPlayer.Character:FindFirstChild("RightLowerArm").BrickColor = BrickColor.new(Color3.new(r/ 255,g/ 255,b/ 255))
  81. game.Players.LocalPlayer.Character:FindFirstChild("RightHand").BrickColor = BrickColor.new(Color3.new(r/ 255,g/ 255,b/ 255))
  82. game.Players.LocalPlayer.Character:FindFirstChild("RightFoot").BrickColor = BrickColor.new(Color3.new(r/ 255,g/ 255,b/ 255))
  83. game.Players.LocalPlayer.Character:FindFirstChild("LowerTorso").BrickColor = BrickColor.new(Color3.new(r/ 255,g/ 255,b/ 255))
  84. game.Players.LocalPlayer.Character:FindFirstChild("LeftUpperLeg").BrickColor = BrickColor.new(Color3.new(r/ 255,g/ 255,b/ 255))
  85. game.Players.LocalPlayer.Character:FindFirstChild("LeftUpperArm").BrickColor = BrickColor.new(Color3.new(r/ 255,g/ 255,b/ 255))
  86. game.Players.LocalPlayer.Character:FindFirstChild("LeftLowerLeg").BrickColor = BrickColor.new(Color3.new(r/ 255,g/ 255,b/ 255))
  87. game.Players.LocalPlayer.Character:FindFirstChild("LeftLowerArm").BrickColor = BrickColor.new(Color3.new(r/ 255,g/ 255,b/ 255))
  88. game.Players.LocalPlayer.Character:FindFirstChild("LeftHand").BrickColor = BrickColor.new(Color3.new(r/ 255,g/ 255,b/ 255))
  89. game.Players.LocalPlayer.Character:FindFirstChild("LeftFoot").BrickColor = BrickColor.new(Color3.new(r/ 255,g/ 255,b/ 255))
  90.  
  91. preview.BrickColor = BrickColor.new(Color3.new(r / 255, g / 255, b / 255))
  92. data[tonumber(setColor)][1] = rawh
  93. data[tonumber(setColor)][2] = m
  94. data[tonumber(setColor)][3] = rawv
  95.  
  96. end
  97.  
  98. return Color3.new(r / 255, g / 255, b / 255)
  99.  
  100. end
  101.  
  102. spectre.MouseButton1Down:connect(function(x, y) isDown["h1"] = true HSVtoRGB(x, nil, y, "1") end)
  103. spectre.MouseButton2Down:connect(function(x, y) isDown["h2"] = true HSVtoRGB(x, nil, y, "2") end)
  104. mouse.Move:connect(function() if isDown["h1"] then HSVtoRGB(mouse.X,nil,mouse.Y,"1") elseif isDown["h2"] then HSVtoRGB(mouse.X,nil,mouse.Y,"2")
  105. elseif isDown["s1"] then HSVtoRGB(data[1][1], mouse.Y, data[1][3], "1") elseif isDown["s2"] then HSVtoRGB(data[2][1], mouse.Y, data[2][3], "2") end end)
  106. spectre.MouseButton1Up:connect(function() isDown["h1"] = nil end) mouse.Button1Up:connect(function() isDown["h1"], isDown["s1"] = nil, nil end)
  107. spectre.MouseButton2Up:connect(function() isDown["h2"] = nil end) mouse.Button2Up:connect(function() isDown["h2"], isDown["s2"] = nil, nil end)
  108. sat.MouseButton1Up:connect(function() isDown["s1"] = nil end) sat.MouseButton1Down:connect(function(x, y) isDown["s1"] = true
  109. HSVtoRGB(data[1][1], y, data[1][3], "1") end)
  110. sat.MouseButton2Up:connect(function() isDown["s2"] = nil end) sat.MouseButton2Down:connect(function(x, y) isDown["s2"] = true
  111. HSVtoRGB(data[2][1], y, data[2][3], "2") end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement