Josiahiscool73

Inventory viewer

Aug 25th, 2025
13
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.26 KB | None | 0 0
  1.  
  2. --// services
  3. local ts = game:GetService("TweenService")
  4. local rs = game:GetService("RunService")
  5. local uis = game:GetService("UserInputService")
  6. local players = game:GetService("Players")
  7.  
  8. --// config
  9. local lp = players.LocalPlayer
  10. if not lp then return end
  11.  
  12. local CONFIG = {
  13. distance = 16,
  14. scrollSpeed = 20,
  15. animTime = 0.3,
  16. platforms = {
  17. PC = {"rbxassetid://10688463768", Color3.fromRGB(80, 140, 220)},
  18. Mobile = {"rbxassetid://10688464303", Color3.fromRGB(80, 220, 120)},
  19. Console = {"rbxassetid://10688463319", Color3.fromRGB(220, 80, 80)},
  20. Unknown = {"", Color3.fromRGB(150, 150, 150)}
  21. }
  22. }
  23.  
  24. --// 'secret' state management
  25. _G.BillboardState = {
  26. enabled = true,
  27. uis = {}, -- { [Player]: { gui, root, main, currentState, tweens } }
  28. activeScroller = nil
  29. }
  30.  
  31. --// functions
  32. local function getPlayerPlatform(player)
  33. local platform = "Unknown"
  34. if player.GameplayPaused then platform = "Mobile" end
  35. if uis:GetPlatform() == Enum.Platform.Windows and player == lp then platform = "PC" end
  36. return platform
  37. end
  38.  
  39. local function animate(state, direction)
  40. if state.tweens then
  41. for _, t in ipairs(state.tweens) do t:Cancel() end
  42. end
  43. state.tweens = {}
  44.  
  45. local transparencyGoal, sizeGoal
  46. if direction == "in" then
  47. transparencyGoal, sizeGoal = 0.2, UDim2.fromScale(1, 1)
  48. else
  49. transparencyGoal, sizeGoal = 1, UDim2.fromScale(0.8, 0.8)
  50. end
  51.  
  52. local transparencyTween = ts:Create(state.main, TweenInfo.new(CONFIG.animTime, Enum.EasingStyle.Quint), {BackgroundTransparency = transparencyGoal})
  53. local sizeTween = ts:Create(state.root, TweenInfo.new(CONFIG.animTime, Enum.EasingStyle.Quint), {Size = sizeGoal})
  54.  
  55. table.insert(state.tweens, transparencyTween)
  56. table.insert(state.tweens, sizeTween)
  57.  
  58. transparencyTween:Play()
  59. sizeTween:Play()
  60.  
  61. return sizeTween
  62. end
  63.  
  64. local function createElements(player)
  65. local state = { currentState = "hidden", tweens = {} }
  66.  
  67. state.gui = Instance.new("BillboardGui")
  68. state.gui.Name, state.gui.AlwaysOnTop = "PlayerInfo", true
  69. state.gui.Size, state.gui.StudsOffset = UDim2.fromOffset(200, 80), Vector3.new(0, 2.2, 0)
  70.  
  71. state.root = Instance.new("Frame", state.gui)
  72. state.root.Name, state.root.BackgroundTransparency = "Root", 1
  73. state.root.ClipsDescendants, state.root.AnchorPoint = true, Vector2.new(0.5, 0.5)
  74. state.root.Position, state.root.Size = UDim2.fromScale(0.5, 0.5), UDim2.fromScale(0.8, 0.8)
  75.  
  76. state.main = Instance.new("Frame", state.root)
  77. state.main.Name, state.main.Size = "Main", UDim2.fromScale(1, 1)
  78. state.main.BackgroundColor3 = Color3.fromRGB(30, 32, 38)
  79. state.main.Active, state.main.BackgroundTransparency = true, 1
  80. Instance.new("UICorner", state.main).CornerRadius = UDim.new(0, 6)
  81. Instance.new("UIStroke", state.main).Color = Color3.fromRGB(10, 11, 13)
  82.  
  83. local platformIcon = Instance.new("ImageLabel", state.main)
  84. platformIcon.Name, platformIcon.Size = "PlatformIcon", UDim2.fromOffset(14, 14)
  85. platformIcon.Position, platformIcon.BackgroundTransparency = UDim2.new(0, 4, 0, 4), 1
  86.  
  87. local healthBar = Instance.new("Frame", state.main)
  88. healthBar.Name = "HealthBar"
  89. -- FIX: Positioned at the top center
  90. healthBar.Size = UDim2.new(0.8, 0, 0, 8)
  91. healthBar.Position = UDim2.new(0.5, 0, 0, 4)
  92. healthBar.AnchorPoint = Vector2.new(0.5, 0)
  93. healthBar.BackgroundColor3 = Color3.fromRGB(10, 11, 13)
  94. Instance.new("UICorner", healthBar).CornerRadius = UDim.new(1, 0)
  95.  
  96. local healthFill = Instance.new("Frame", healthBar)
  97. healthFill.Name, healthFill.Size = "Fill", UDim2.fromScale(1, 1)
  98. healthFill.BackgroundColor3 = Color3.fromRGB(80, 220, 120)
  99. Instance.new("UICorner", healthFill).CornerRadius = UDim.new(1, 0)
  100.  
  101. local scroller = Instance.new("ScrollingFrame", state.main)
  102. scroller.Name = "Backpack"
  103. -- FIX: Adjusted to fit below the new healthbar position
  104. scroller.Size = UDim2.new(1, -10, 1, -18)
  105. scroller.Position = UDim2.new(0.5, 0, 1, -4)
  106. scroller.AnchorPoint = Vector2.new(0.5, 1)
  107. scroller.BackgroundTransparency, scroller.BorderSizePixel = 1, 0
  108. scroller.ScrollBarThickness, scroller.AutomaticCanvasSize = 4, Enum.AutomaticSize.Y
  109. scroller.MouseEnter:Connect(function() _G.BillboardState.activeScroller = scroller end)
  110. scroller.MouseLeave:Connect(function() _G.BillboardState.activeScroller = nil end)
  111.  
  112. local grid = Instance.new("UIGridLayout", scroller)
  113. grid.CellSize, grid.CellPadding = UDim2.fromOffset(28, 28), UDim2.fromOffset(4, 4)
  114. grid.HorizontalAlignment = Enum.HorizontalAlignment.Center
  115.  
  116. local tooltip = Instance.new("TextLabel", scroller)
  117. tooltip.Name, tooltip.Size = "Tooltip", UDim2.new(1, 0, 0, 20)
  118. tooltip.Position, tooltip.BackgroundColor3 = UDim2.new(0, 0, 1, 22), Color3.fromRGB(10, 11, 13)
  119. tooltip.Font, tooltip.TextColor3, tooltip.TextSize = Enum.Font.SourceSans, Color3.new(1, 1, 1), 14
  120. tooltip.Visible = false
  121. Instance.new("UICorner", tooltip).CornerRadius = UDim.new(0, 4)
  122.  
  123. _G.BillboardState.uis[player] = state
  124. return state
  125. end
  126.  
  127. local function updateUI(player, char)
  128. if not _G.BillboardState.enabled then return end
  129. local state = _G.BillboardState.uis[player]
  130. if not (state and state.gui) then return end
  131.  
  132. local hum = char:FindFirstChildOfClass("Humanoid")
  133. if hum then
  134. local health = math.clamp(hum.Health / hum.MaxHealth, 0, 1)
  135. local fill = state.main.HealthBar.Fill
  136. fill.Size = UDim2.fromScale(health, 1)
  137. fill.BackgroundColor3 = Color3.fromHSV(0.33 * health, 0.7, 0.8)
  138. end
  139.  
  140. local pData = CONFIG.platforms[getPlayerPlatform(player)]
  141. local pIcon = state.main.PlatformIcon
  142. pIcon.Image, pIcon.ImageColor3 = pData[1], pData[2]
  143.  
  144. local scroller = state.main.Backpack
  145. local tooltip = scroller.Tooltip
  146. for _, child in scroller:GetChildren() do
  147. if child:IsA("ImageButton") then child:Destroy() end
  148. end
  149.  
  150. for _, tool in player.Backpack:GetChildren() do
  151. if tool:IsA("Tool") then
  152. local icon = Instance.new("ImageButton", scroller)
  153. icon.Size, icon.BackgroundTransparency, icon.Image = UDim2.fromScale(1, 1), 1, tool.TextureId
  154. icon.MouseEnter:Connect(function() tooltip.Text, tooltip.Visible, tooltip.Parent = tool.Name, true, icon end)
  155. icon.MouseLeave:Connect(function() tooltip.Visible, tooltip.Parent = false, scroller end)
  156. icon.MouseButton1Click:Connect(function() tool:Clone().Parent = lp.Backpack end)
  157. end
  158. end
  159. end
  160.  
  161. --// main loop
  162. rs.Heartbeat:Connect(function()
  163. if not _G.BillboardState.enabled then return end
  164. local localChar = lp.Character
  165. if not (localChar and localChar.PrimaryPart) then return end
  166. local localPos = localChar.PrimaryPart.Position
  167.  
  168. for _, player in players:GetPlayers() do
  169. if player == lp then continue end
  170.  
  171. local state = _G.BillboardState.uis[player] or createElements(player)
  172. local char = player.Character
  173.  
  174. if char and char.PrimaryPart and char:FindFirstChild("Head") then
  175. local dist = (localPos - char.PrimaryPart.Position).Magnitude
  176.  
  177. if dist <= CONFIG.distance and state.currentState == "hidden" then
  178. state.currentState = "visible"
  179. state.gui.Adornee = char.Head
  180. state.gui.Parent = char.Head
  181. animate(state, "in")
  182. elseif dist > CONFIG.distance and state.currentState == "visible" then
  183. state.currentState = "hidden"
  184. local tween = animate(state, "out")
  185. tween.Completed:Wait()
  186. if state.currentState == "hidden" then state.gui.Parent = nil end
  187. end
  188.  
  189. if state.currentState == "visible" then updateUI(player, char) end
  190. elseif state.currentState == "visible" then
  191. state.currentState = "hidden"
  192. state.gui.Parent = nil
  193. end
  194. end
  195. end)
  196.  
  197. --// controller & cleanup
  198. uis.InputChanged:Connect(function(input)
  199. if not _G.BillboardState.enabled or not _G.BillboardState.activeScroller then return end
  200. if input.UserInputType == Enum.UserInputType.Gamepad1 and input.KeyCode == Enum.KeyCode.Gamepad1_Thumbstick2 then
  201. local scroller = _G.BillboardState.activeScroller
  202. scroller.CanvasPosition -= Vector2.new(0, input.Position.Y * CONFIG.scrollSpeed)
  203. end
  204. end)
  205.  
  206. players.PlayerRemoving:Connect(function(player)
  207. if _G.BillboardState.uis[player] then
  208. _G.BillboardState.uis[player].gui:Destroy()
  209. _G.BillboardState.uis[player] = nil
  210. end
  211. end)
  212.  
  213. lp.Chatted:Connect(function(msg)
  214. if msg == "#FreeSchlep" and _G.BillboardState.enabled then
  215. _G.BillboardState.enabled = false
  216. for _, state in pairs(_G.BillboardState.uis) do state.gui:Destroy() end
  217. _G.BillboardState.uis = {}
  218. end
  219. end)
Add Comment
Please, Sign In to add comment