Meliodas0_0

ProtoSmasher Window Class

Feb 19th, 2020
108
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- Main
  2. local window = Window.new("Example")
  3.  
  4. -- Label
  5. local label = window:AddElement("Label")
  6. label.Text = "Example Label"
  7. label.AlignToFramePadding = false
  8.  
  9. -- Toggle
  10. local checkbox = window:AddElement("Checkbox")
  11. checkbox.Label = "Example Toggle"
  12.  
  13. -- Button
  14. local button1 = window:AddElement("Button")
  15. button1.Label = "Print Toggle"
  16. button1.OnClick = function()
  17. print(checkbox.State)
  18. end
  19.  
  20. -- Horizontal Separator
  21. window:AddElement("HorizontalSeparator")
  22.  
  23. -- Variable
  24. local old = workspace.CurrentCamera.FieldOfView
  25.  
  26. -- Int Slider
  27. local intSlider = window:AddElement("IntSlider")
  28. intSlider.Min = math.floor(workspace.CurrentCamera.FieldOfView)
  29. intSlider.Max = 120
  30. intSlider.Value = old
  31. intSlider.Label = "FOV (int)"
  32.  
  33. -- Button
  34. local button2 = window:AddElement("Button")
  35. button2.Label = "Set FOV (int)"
  36. button2.OnClick = function()
  37. workspace.CurrentCamera.FieldOfView = intSlider.Value
  38. end
  39.  
  40. -- Button
  41. local button3 = window:AddElement("Button")
  42. button3.Label = "Reset FOV (int)"
  43. button3.OnClick = function()
  44. intSlider.Value = old
  45. workspace.CurrentCamera.FieldOfView = old
  46. end
  47.  
  48. -- Horizontal Separator
  49. window:AddElement("HorizontalSeparator")
  50.  
  51. -- Float Slider
  52. local floatSlider = window:AddElement("FloatSlider")
  53. floatSlider.Min = math.floor(workspace.CurrentCamera.FieldOfView)
  54. floatSlider.Max = 120
  55. floatSlider.Value = old
  56. floatSlider.Label = "FOV (float)"
  57.  
  58. -- Button
  59. local button4 = window:AddElement("Button")
  60. button4.Label = "Set FOV (float)"
  61. button4.OnClick = function()
  62. workspace.CurrentCamera.FieldOfView = floatSlider.Value
  63. end
  64.  
  65. -- Button
  66. local button5 = window:AddElement("Button")
  67. button5.Label = "Reset FOV (float)"
  68. button5.OnClick = function()
  69. floatSlider.Value = old
  70. workspace.CurrentCamera.FieldOfView = old
  71. end
  72.  
  73. -- Text Input
  74. --[[ Text Input was broken when I wrote this - may be fixed in the future
  75. local textInput = window:AddElement("TextInput")
  76. textInput.Label = "WalkSpeed"
  77. textInput.ReadOnly = false
  78. textInput.MultiLine = false
  79. textInput.Password = false
  80. ]]
  81.  
  82. -- Horizontal Separator
  83. window:AddElement("HorizontalSeparator")
  84.  
  85. -- List
  86. local list = window:AddElement("List")
  87. list.Label = "Example"
  88. list.Items = {"kiriot", "magikmanz", "gamer vision", "ironbrew", "wally", "firefox", "this is epic"}
  89. list.ItemsToShow = 3
  90.  
  91. -- Button
  92. local button7 = window:AddElement("Button")
  93. button7.Label = "Print List"
  94. button7.OnClick = function()
  95. print(list.Selected)
  96. print(list.Items[list.Selected+1])
  97. end
  98.  
  99. -- Horizontal Separator
  100. window:AddElement("HorizontalSeparator")
  101.  
  102. -- Dropdown
  103. local dropdown = window:AddElement("Dropdown")
  104. dropdown.Label = "Example"
  105. dropdown.Options = {"jewelryin", "jewelryout", "bank", "gas", "prison", "crimbase1", "crimbase2"}
  106.  
  107. -- Button
  108. local button6 = window:AddElement("Button")
  109. button6.Label = "Print Dropdown"
  110. button6.OnClick = function()
  111. print(dropdown.Selected)
  112. print(dropdown.Options[dropdown.Selected+1])
  113. end
  114.  
  115. -- Horizontal Separator
  116. window:AddElement("HorizontalSeparator")
  117.  
  118. -- Color Picker
  119. local colorPicker = window:AddElement("ColorPicker")
  120. colorPicker.Label = "Color Picker"
  121.  
  122. -- Print Color
  123. local button8 = window:AddElement("Button")
  124. button8.Label = "Print Color"
  125. button8.OnClick = function()
  126. print(colorPicker.Color)
  127. game.Players.LocalPlayer.Character.Head.Color = colorPicker.Color
  128. end
RAW Paste Data