Advertisement
lolzc4

teampicker

Nov 13th, 2021
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 8.22 KB | None | 0 0
  1. script.Parent.Activated:Connect(function()
  2.     local ColorPicker = Instance.new("ScreenGui")
  3.     local TopBar = Instance.new("Frame")
  4.     local ColorPicker_2 = Instance.new("Frame")
  5.     local UIPadding = Instance.new("UIPadding")
  6.     local Value = Instance.new("Frame")
  7.     local UIGradient = Instance.new("UIGradient")
  8.     local Frame = Instance.new("Frame")
  9.     local Bottom = Instance.new("Frame")
  10.     local UIListLayout = Instance.new("UIListLayout")
  11.     local ColorPreview = Instance.new("Frame")
  12.     local OK = Instance.new("TextButton")
  13.     local HueSaturation = Instance.new("ImageLabel")
  14.     local Frame_2 = Instance.new("Frame")
  15.     local TextLabel = Instance.new("TextLabel")
  16.  
  17.     ColorPicker.Name = "ColorPicker"
  18.     ColorPicker.Parent = game.CoreGui
  19.     ColorPicker.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
  20.  
  21.     TopBar.Name = "TopBar"
  22.     TopBar.Parent = ColorPicker
  23.     TopBar.BackgroundColor3 = Color3.fromRGB(60, 60, 60)
  24.     TopBar.BorderSizePixel = 0
  25.     TopBar.Position = UDim2.new(0.369488537, 0, 0.458181828, 0)
  26.     TopBar.Size = UDim2.new(0, 288, 0, 21)
  27.  
  28.     local UserInputService = game:GetService("UserInputService")
  29.  
  30.     local gui = TopBar
  31.  
  32.     local dragging
  33.     local dragInput
  34.     local dragStart
  35.     local startPos
  36.  
  37.     local function update(input)
  38.         local delta = input.Position - dragStart
  39.         gui.Position = UDim2.new(startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, startPos.Y.Offset + delta.Y)
  40.     end
  41.  
  42.     gui.InputBegan:Connect(function(input)
  43.         if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
  44.             dragging = true
  45.             dragStart = input.Position
  46.             startPos = gui.Position
  47.  
  48.             input.Changed:Connect(function()
  49.                 if input.UserInputState == Enum.UserInputState.End then
  50.                     dragging = false
  51.                 end
  52.             end)
  53.         end
  54.     end)
  55.  
  56.     gui.InputChanged:Connect(function(input)
  57.         if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then
  58.             dragInput = input
  59.         end
  60.     end)
  61.  
  62.     UserInputService.InputChanged:Connect(function(input)
  63.         if input == dragInput and dragging then
  64.             update(input)
  65.         end
  66.     end)
  67.  
  68.     ColorPicker_2.Name = "ColorPicker"
  69.     ColorPicker_2.Parent = TopBar
  70.     ColorPicker_2.BackgroundColor3 = Color3.fromRGB(46, 46, 46)
  71.     ColorPicker_2.BorderSizePixel = 0
  72.     ColorPicker_2.Position = UDim2.new(0, 0, 1, 0)
  73.     ColorPicker_2.Size = UDim2.new(0, 288, 0, 273)
  74.  
  75.     UIPadding.Parent = ColorPicker_2
  76.     UIPadding.PaddingBottom = UDim.new(0, 5)
  77.     UIPadding.PaddingLeft = UDim.new(0, 5)
  78.     UIPadding.PaddingRight = UDim.new(0, 5)
  79.     UIPadding.PaddingTop = UDim.new(0, 5)
  80.  
  81.     Value.Name = "Value"
  82.     Value.Parent = ColorPicker_2
  83.     Value.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  84.     Value.BorderSizePixel = 0
  85.     Value.Position = UDim2.new(1, -20, 0, 0)
  86.     Value.Size = UDim2.new(0, 20, 1, -45)
  87.  
  88.     UIGradient.Color = ColorSequence.new{ColorSequenceKeypoint.new(0.00, Color3.fromRGB(255, 0, 0)), ColorSequenceKeypoint.new(1.00, Color3.fromRGB(0, 0, 0))}
  89.     UIGradient.Rotation = 90
  90.     UIGradient.Parent = Value
  91.  
  92.     Frame.Parent = Value
  93.     Frame.BackgroundColor3 = Color3.fromRGB(60, 60, 60)
  94.     Frame.BorderSizePixel = 0
  95.     Frame.Position = UDim2.new(0, -2, 0, 0)
  96.     Frame.Size = UDim2.new(1, 4, 0, 5)
  97.  
  98.     Bottom.Name = "Bottom"
  99.     Bottom.Parent = ColorPicker_2
  100.     Bottom.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  101.     Bottom.BackgroundTransparency = 1.000
  102.     Bottom.Position = UDim2.new(0, 0, 1, -40)
  103.     Bottom.Size = UDim2.new(1, 0, 0, 40)
  104.  
  105.     UIListLayout.Parent = Bottom
  106.     UIListLayout.FillDirection = Enum.FillDirection.Horizontal
  107.     UIListLayout.SortOrder = Enum.SortOrder.LayoutOrder
  108.     UIListLayout.Padding = UDim.new(0, 5)
  109.  
  110.     ColorPreview.Name = "ColorPreview"
  111.     ColorPreview.Parent = Bottom
  112.     ColorPreview.BackgroundColor3 = Color3.fromRGB(255, 0, 0)
  113.     ColorPreview.BorderSizePixel = 0
  114.     ColorPreview.Size = UDim2.new(0.5, -2, 1, 0)
  115.  
  116.     OK.Name = "OK"
  117.     OK.Parent = Bottom
  118.     OK.BackgroundColor3 = Color3.fromRGB(60, 60, 60)
  119.     OK.BorderSizePixel = 0
  120.     OK.Size = UDim2.new(0.5, -2, 1, 0)
  121.     OK.Font = Enum.Font.ArialBold
  122.     OK.Text = "OK"
  123.     OK.TextColor3 = Color3.fromRGB(255, 255, 255)
  124.     OK.TextSize = 16.000
  125.  
  126.     HueSaturation.Name = "HueSaturation"
  127.     HueSaturation.Parent = ColorPicker_2
  128.     HueSaturation.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  129.     HueSaturation.BorderSizePixel = 0
  130.     HueSaturation.Size = UDim2.new(1, -25, 1, -45)
  131.     HueSaturation.Image = "http://www.roblox.com/asset/?id=328298876"
  132.  
  133.     Frame_2.Parent = HueSaturation
  134.     Frame_2.AnchorPoint = Vector2.new(0.5, 0.5)
  135.     Frame_2.BackgroundColor3 = Color3.fromRGB(60, 60, 60)
  136.     Frame_2.BorderSizePixel = 0
  137.     Frame_2.Size = UDim2.new(0, 5, 0, 5)
  138.  
  139.     TextLabel.Parent = TopBar
  140.     TextLabel.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  141.     TextLabel.BackgroundTransparency = 1.000
  142.     TextLabel.Size = UDim2.new(1, 0, 1, 0)
  143.     TextLabel.Font = Enum.Font.ArialBold
  144.     TextLabel.Text = "Team picker | exported from Portal v2"
  145.     TextLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
  146.     TextLabel.TextSize = 16.000
  147.  
  148.     local Button1Down = false
  149.     local currentColor = {h=0,s=1,v=1}
  150.  
  151.     function calculateLocalMousePosition(object)
  152.         local positionX,positionY = object.AbsolutePosition.X,object.AbsolutePosition.Y
  153.         local mouseX, mouseY = game.Players.LocalPlayer:GetMouse().X,game.Players.LocalPlayer:GetMouse().Y
  154.  
  155.         return Vector2.new(mouseX-positionX, mouseY-positionY)
  156.     end
  157.  
  158.     function isHoveringOver(object)
  159.         local position = object.AbsolutePosition
  160.         local size = object.AbsoluteSize
  161.         local mouse = game.Players.LocalPlayer:GetMouse()
  162.         local localMouse = calculateLocalMousePosition(object)
  163.  
  164.         if (mouse.X >= position.X and mouse.Y >= position.Y) and (localMouse.X <= size.X and localMouse.Y <= size.Y) then
  165.             return true
  166.         else
  167.             return false
  168.         end
  169.     end
  170.  
  171.     function updatePreview()
  172.         ColorPreview.BackgroundColor3 = Color3.fromHSV(currentColor.h,currentColor.s,currentColor.v)
  173.     end
  174.  
  175.     function hueSaturationCheck() -- script made by Vapin' Cat#5497
  176.         if isHoveringOver(HueSaturation) then
  177.             local LocalOffset = calculateLocalMousePosition(HueSaturation)
  178.             local LocalScaleX, LocalScaleY = LocalOffset.X/HueSaturation.AbsoluteSize.X,LocalOffset.Y/HueSaturation.AbsoluteSize.Y
  179.  
  180.             HueSaturation.Frame.Position = UDim2.new(LocalScaleX, 0, LocalScaleY, 0)
  181.             currentColor.h = 1-LocalScaleX
  182.             currentColor.s = 1-LocalScaleY
  183.  
  184.             UIGradient.Color = ColorSequence.new{ColorSequenceKeypoint.new(0.00, Color3.fromHSV(currentColor.h,currentColor.s,1)), ColorSequenceKeypoint.new(1.00, Color3.fromRGB(0, 0, 0))}
  185.  
  186.             updatePreview()
  187.         end
  188.     end
  189.  
  190.     function valueCheck()
  191.         if isHoveringOver(Value) then
  192.             local LocalOffset = calculateLocalMousePosition(Value)
  193.             local LocalScaleY = LocalOffset.Y/HueSaturation.AbsoluteSize.Y
  194.  
  195.             Value.Frame.Position = UDim2.new(0, 0, LocalScaleY, 0)
  196.             currentColor.v = 1-LocalScaleY
  197.  
  198.             updatePreview()
  199.         end
  200.     end
  201.  
  202.     function refresh(color)
  203.         local position = workspace:FindFirstChild(game.Players.LocalPlayer.Name).HumanoidRootPart.CFrame
  204.         local _, RY, _ = position:ToOrientation()
  205.         position = CFrame.new(position.p) * CFrame.fromOrientation(0, RY, 0)
  206.  
  207.         local camera = workspace.CurrentCamera.CFrame
  208.  
  209.         if tostring(game.Players.LocalPlayer.TeamColor) == 'Medium stone grey' and color == nil then
  210.             workspace.Remote.TeamEvent:FireServer("Bright orange")
  211.  
  212.             wait()
  213.  
  214.             workspace.Remote.loadchar:InvokeServer()
  215.  
  216.             workspace.Remote.TeamEvent:FireServer("Medium stone grey")
  217.         else
  218.             workspace.Remote.loadchar:InvokeServer(nil,color)
  219.         end
  220.  
  221.         local HumanoidRootPart = workspace:FindFirstChild(game.Players.LocalPlayer.Name):WaitForChild('HumanoidRootPart',0.3)
  222.  
  223.         HumanoidRootPart.CFrame = position
  224.  
  225.         workspace.CurrentCamera.CFrame = camera
  226.         workspace.CurrentCamera.Changed:Wait()
  227.         workspace.CurrentCamera.CFrame = camera
  228.  
  229.         game:GetService("StarterGui"):SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, true)
  230.     end
  231.  
  232.     game.Players.LocalPlayer:GetMouse().Button1Down:Connect(function()
  233.         Button1Down = true
  234.         hueSaturationCheck()
  235.         valueCheck()
  236.     end)
  237.  
  238.     game.Players.LocalPlayer:GetMouse().Button1Up:Connect(function()
  239.         Button1Down = false
  240.     end)
  241.  
  242.     game.Players.LocalPlayer:GetMouse().Move:Connect(function()
  243.         if Button1Down then
  244.             hueSaturationCheck()
  245.             valueCheck()
  246.         end
  247.     end)
  248.  
  249.     OK.MouseButton1Down:Connect(function()
  250.         refresh(Color3.fromHSV(currentColor.h,currentColor.s,currentColor.v))
  251.     end)
  252. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement