Advertisement
rrixh

(lulaslollipop) RRixh ui lib

Sep 9th, 2024 (edited)
461
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 10.00 KB | None | 0 0
  1. -- How To Use: https://pastebin.com/vkiukvrX
  2.  
  3. local TweenService = game:GetService("TweenService")
  4. local UserInputService = game:GetService("UserInputService")
  5.  
  6. -- UI kustomizable
  7. local TopBoarder_Kolor = Color3.fromRGB(30, 30, 30)
  8. local TabsButton_Kolor = Color3.fromRGB(255, 148, 148)
  9. local TabsText_Kolor = Color3.fromRGB(255, 255, 255)
  10. local PageOpened_Kolor = Color3.fromRGB(0, 180, 0)
  11. local GuiFrame_Kolor = Color3.fromRGB(30, 30, 30)
  12. local OpenGui_Kolor = Color3.fromRGB(190, 46, 28)
  13. local dragFX = Color3.fromRGB(255, 255, 255)
  14. local buttonKlickedGlow = Color3.fromRGB(0, 190, 0)
  15. local toggleButtonImageID = "6031068420" -- Replace with your image ID (without 'rbxassetid://')
  16. local paddingHeight = 5 -- Padding height for the layout
  17.  
  18. -- Create GUI elements
  19. local screenGui = Instance.new("ScreenGui")
  20. local mainFrame = Instance.new("Frame")
  21. local topBoarder = Instance.new("Frame")
  22. local titleLabel = Instance.new("TextLabel")
  23. local pages = {}
  24. local pageNames = {"Home", "Skripts", "Player", "More", "Settings"}
  25. local tabButtons = {}
  26. local guiToggleButton = Instance.new("TextButton")
  27. local guiToggleButtonImage = Instance.new("ImageLabel")
  28. local closeButton = Instance.new("ImageButton")
  29. local uiGradient = Instance.new("UIGradient")
  30.  
  31. local hasMoved = false
  32. local dragThreshold = 5
  33. local dragging, dragInput, dragStart, startPos
  34.  
  35. screenGui.Parent = game.CoreGui
  36.  
  37. -- Main frame
  38. mainFrame.Size = UDim2.new(0.5, 0, 0.5, 0)
  39. mainFrame.Position = UDim2.new(0.25, 0, 0.25, 0)
  40. mainFrame.BackgroundColor3 = GuiFrame_Kolor
  41. mainFrame.ClipsDescendants = true
  42. mainFrame.Parent = screenGui
  43.  
  44. -- Top boarder
  45. topBoarder.Size = UDim2.new(1, 0, 0, 30)
  46. topBoarder.BackgroundColor3 = TopBoarder_Kolor
  47. topBoarder.Parent = mainFrame
  48.  
  49. -- Title label
  50. titleLabel.Size = UDim2.new(1, -60, 1, 0)
  51. titleLabel.Position = UDim2.new(0, 30, 0, 0)
  52. titleLabel.BackgroundTransparency = 1
  53. titleLabel.Text = "RRixh Hub 👺"
  54. titleLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
  55. titleLabel.Parent = topBoarder
  56.  
  57. -- Create pages with scrollable content
  58. for i, name in ipairs(pageNames) do
  59. local scrollingFrame = Instance.new("ScrollingFrame")
  60. scrollingFrame.Name = name
  61. scrollingFrame.Size = UDim2.new(1, 0, 1, -60) -- Reserving space for tab buttons and top boarder
  62. scrollingFrame.Position = UDim2.new(0, 0, 0, 60)
  63. scrollingFrame.Visible = i == 1 -- Only the first page is visible by default
  64. scrollingFrame.ScrollBarThickness = 10
  65. scrollingFrame.CanvasSize = UDim2.new(0, 0, 0, 0)
  66. scrollingFrame.Parent = mainFrame
  67. pages[name] = scrollingFrame
  68.  
  69. -- Layout inside the scrolling frame
  70. local layout = Instance.new("UIListLayout")
  71. layout.Padding = UDim.new(0, paddingHeight) -- Add padding between items
  72. layout.Parent = scrollingFrame
  73.  
  74. -- Automatically adjust the canvas size when items are added/removed
  75. layout.Changed:Connect(function(property)
  76. if property == "AbsoluteContentSize" then
  77. scrollingFrame.CanvasSize = UDim2.new(0, 0, 0, layout.AbsoluteContentSize.Y)
  78. end
  79. end)
  80.  
  81. local label = Instance.new("TextLabel")
  82. label.Text = name
  83. label.Size = UDim2.new(1, 0, 0, 30)
  84. label.TextColor3 = Color3.fromRGB(255, 255, 255)
  85. label.BackgroundTransparency = 1
  86. label.Parent = scrollingFrame
  87. end
  88.  
  89. -- Create tab buttons
  90. for i, name in ipairs(pageNames) do
  91. local tabButton = Instance.new("TextButton")
  92. tabButton.Text = name
  93. tabButton.Size = UDim2.new(0.2, 0, 0, 30)
  94. tabButton.Position = UDim2.new((i-1) * 0.2, 0, 0, 30)
  95. tabButton.BackgroundColor3 = TabsButton_Kolor
  96. tabButton.TextColor3 = TabsText_Kolor
  97. tabButton.Parent = mainFrame
  98. tabButtons[name] = tabButton
  99.  
  100. tabButton.MouseButton1Click:Connect(function()
  101. for _, btn in pairs(tabButtons) do
  102. btn.BackgroundColor3 = TabsButton_Kolor
  103. end
  104. tabButton.BackgroundColor3 = PageOpened_Kolor
  105. for _, page in pairs(pages) do
  106. page.Visible = false
  107. end
  108. pages[name].Visible = true
  109. end)
  110. end
  111.  
  112. -- Close button
  113. closeButton.Size = UDim2.new(0, 30, 0, 30)
  114. closeButton.Position = UDim2.new(1, -30, 0, 0)
  115. closeButton.Image = "rbxassetid://6035047377" -- Red "X" icon
  116. closeButton.BackgroundTransparency = 1
  117. closeButton.Parent = topBoarder
  118. closeButton.MouseButton1Click:Connect(function()
  119. local tweenInfo = TweenInfo.new(0.3, Enum.EasingStyle.Quad, Enum.EasingDirection.Out)
  120. local hideTween = TweenService:Create(mainFrame, tweenInfo, {Size = UDim2.new(0, 0, 0, 0), Position = UDim2.new(0.5, 0, 0.5, 0)})
  121. hideTween:Play()
  122. hideTween.Completed:Connect(function()
  123. mainFrame.Visible = false
  124. guiToggleButton.Visible = true
  125. end)
  126. end)
  127.  
  128. -- GUI toggle button
  129. guiToggleButton.Size = UDim2.new(0, 100, 0, 30)
  130. guiToggleButton.BackgroundColor3 = OpenGui_Kolor
  131. guiToggleButton.Text = "Show GUI"
  132. guiToggleButton.Position = UDim2.new(0.5, -50, 0, 0) -- Center of the screen at the top
  133. guiToggleButton.Visible = false
  134. guiToggleButton.Parent = screenGui
  135.  
  136. -- Adding image to the GUI toggle button
  137. guiToggleButtonImage.Size = UDim2.new(0, 24, 0, 24)
  138. guiToggleButtonImage.Position = UDim2.new(0, 5, 0, 3) -- Adjust the position as per your needs
  139. guiToggleButtonImage.BackgroundTransparency = 1
  140. guiToggleButtonImage.Image = "rbxassetid://" .. toggleButtonImageID
  141. guiToggleButtonImage.Parent = guiToggleButton
  142.  
  143. -- Adding UIStroke to the GUI toggle button
  144. local toggleButtonGlowEffect = Instance.new("UIStroke")
  145. toggleButtonGlowEffect.Parent = guiToggleButton
  146. toggleButtonGlowEffect.Color = dragFX
  147. toggleButtonGlowEffect.Thickness = 2
  148. toggleButtonGlowEffect.Transparency = 1
  149.  
  150. guiToggleButton.MouseButton1Click:Connect(function()
  151. if not hasMoved then
  152. guiToggleButton.Visible = false
  153. mainFrame.Visible = true
  154. local tweenInfo = TweenInfo.new(0.3, Enum.EasingStyle.Quad, Enum.EasingDirection.Out)
  155. local showTween = TweenService:Create(mainFrame, tweenInfo, {Size = UDim2.new(0.5, 0, 0.5, 0), Position = UDim2.new(0.25, 0, 0.25, 0)})
  156. showTween:Play()
  157. end
  158. hasMoved = false -- Reset move status
  159. end)
  160.  
  161. -- Make draggable function
  162. local function makeDraggable(topObject, object, glowEffect)
  163. local dragging = false
  164. local dragInput, dragStart, startPos
  165.  
  166. local function update(input)
  167. local delta = input.Position - dragStart
  168. object.Position = UDim2.new(
  169. startPos.X.Scale,
  170. startPos.X.Offset + delta.X,
  171. startPos.Y.Scale,
  172. startPos.Y.Offset + delta.Y
  173. )
  174. if (math.abs(delta.X) >= dragThreshold or math.abs(delta.Y) >= dragThreshold) then
  175. hasMoved = true
  176. end
  177. end
  178.  
  179. topObject.InputBegan:Connect(function(input)
  180. if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
  181. dragging = true
  182. dragStart = input.Position
  183. startPos = object.Position
  184.  
  185. -- Start glowing effect
  186. TweenService:Create(glowEffect, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {Transparency = 0}):Play()
  187.  
  188. input.Changed:Connect(function()
  189. if input.UserInputState == Enum.UserInputState.End then
  190. dragging = false
  191.  
  192. -- End glowing effect
  193. TweenService:Create(glowEffect, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {Transparency = 1}):Play()
  194. end
  195. end)
  196. end
  197. end)
  198.  
  199. topObject.InputChanged:Connect(function(input)
  200. if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then
  201. dragInput = input
  202. end
  203. end)
  204.  
  205. UserInputService.InputChanged:Connect(function(input)
  206. if input == dragInput and dragging then
  207. update(input)
  208. end
  209. end)
  210. end
  211.  
  212. -- Adding UIStroke to mainFrame for glowing drag effect
  213. local mainFrameGlowEffect = Instance.new("UIStroke")
  214. mainFrameGlowEffect.Parent = mainFrame
  215. mainFrameGlowEffect.Color = dragFX
  216. mainFrameGlowEffect.Thickness = 2
  217. mainFrameGlowEffect.Transparency = 1
  218.  
  219. makeDraggable(topBoarder, mainFrame, mainFrameGlowEffect)
  220. makeDraggable(guiToggleButton, guiToggleButton, toggleButtonGlowEffect)
  221.  
  222. -- Define the "lula" table with functions
  223. local lula = {
  224. Button = function(pageName, buttonText, onClick)
  225. local button = Instance.new("TextButton")
  226. button.Text = buttonText
  227. button.Size = UDim2.new(1, 0, 0, 30)
  228. button.BackgroundColor3 = TabsButton_Kolor
  229. button.TextColor3 = TabsText_Kolor
  230. button.Parent = pages[pageName]
  231.  
  232. local buttonGlowEffect = Instance.new("UIStroke")
  233. buttonGlowEffect.Parent = button
  234. buttonGlowEffect.Color = buttonKlickedGlow
  235. buttonGlowEffect.Thickness = 2
  236. buttonGlowEffect.Transparency = 1
  237.  
  238. button.MouseButton1Down:Connect(function()
  239. TweenService:Create(buttonGlowEffect, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {Transparency = 0}):Play()
  240. end)
  241.  
  242. button.MouseButton1Up:Connect(function()
  243. TweenService:Create(buttonGlowEffect, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {Transparency = 1}):Play()
  244. end)
  245.  
  246. button.MouseLeave:Connect(function()
  247. TweenService:Create(buttonGlowEffect, TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {Transparency = 1}):Play()
  248. end)
  249.  
  250. button.MouseButton1Click:Connect(onClick)
  251.  
  252. return button
  253. end,
  254.  
  255. Toggle = function(pageName, toggleText, onToggle)
  256. local toggleButton = Instance.new("TextButton")
  257. toggleButton.Text = toggleText
  258. toggleButton.Size = UDim2.new(1, 0, 0, 30)
  259. toggleButton.BackgroundColor3 = TabsButton_Kolor
  260. toggleButton.TextColor3 = TabsText_Kolor
  261. toggleButton.Parent = pages[pageName]
  262. local toggled = false
  263. toggleButton.MouseButton1Click:Connect(function()
  264. toggled = not toggled
  265. toggleButton.BackgroundColor3 = toggled and PageOpened_Kolor or TabsButton_Kolor
  266. onToggle(toggled)
  267. end)
  268. return toggleButton
  269. end,
  270.  
  271. Textbox = function(pageName, placeholderText, onTextChanged)
  272. local textBox = Instance.new("TextBox")
  273. textBox.PlaceholderText = placeholderText
  274. textBox.Size = UDim2.new(1, 0, 0, 30)
  275. textBox.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  276. textBox.TextColor3 = Color3.fromRGB(0, 0, 0)
  277. textBox.Parent = pages[pageName]
  278. textBox.FocusLost:Connect(function(enterPressed)
  279. if enterPressed then
  280. onTextChanged(textBox.Text)
  281. end
  282. end)
  283. return textBox
  284. end,
  285.  
  286. SetTitle = function(newTitle)
  287. titleLabel.Text = newTitle
  288. end,
  289.  
  290. ToggleText = function(newguitxt)
  291. guiToggleButton.Text = newguitxt
  292. end,
  293.  
  294. SetToggleImageID = function(newImageID)
  295. toggleButtonImageID = newImageID
  296. guiToggleButtonImage.Image = "rbxassetid://" .. toggleButtonImageID
  297. end
  298. }
  299.  
  300. return lula;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement