Guest User

starterplayerscrengui

a guest
Nov 14th, 2025
8
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 67.83 KB | None | 0 0
  1. SCREENGUI ([GUI NAME]>LOCALSCRIPT). ALL OF THEM ARE LOCALSCRIPTS IN THE SCREENGUI. THESE SCRIPTS ARE LOCALSCRIPTS FOR EACH SCREENGUI
  2. -BRUSHINGMINIGAMEGUI
  3. -- StarterGui > BrushingMinigameGui > LocalScript
  4. -- MOBILE/PC/CONSOLE COMPATIBLE - Click/Tap to play
  5.  
  6. print("๐ŸŽฎ LOADING BRUSHING MINIGAME SCRIPT...")
  7.  
  8. --โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
  9. -- CONFIGURATION
  10. --โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
  11. local INDICATOR_SPEED = 0.01 -- Speed of movement (lower = faster)
  12. local GREEN_ZONE_SIZE = 0.2 -- Size of green zone
  13. local SUCCESS_ATTEMPTS = 3 -- Hits needed
  14.  
  15. --โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
  16. -- SETUP
  17. --โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
  18. local Players = game:GetService("Players")
  19. local ReplicatedStorage = game:GetService("ReplicatedStorage")
  20. local UserInputService = game:GetService("UserInputService")
  21. local ContextActionService = game:GetService("ContextActionService")
  22.  
  23. local player = Players.LocalPlayer
  24. local gui = script.Parent
  25.  
  26. -- Get UI elements
  27. local mainFrame = gui:FindFirstChild("MainFrame")
  28. if not mainFrame then
  29. warn("โŒ MainFrame missing!")
  30. return
  31. end
  32.  
  33. local titleLabel = mainFrame:FindFirstChild("TitleLabel")
  34. local progressBar = mainFrame:FindFirstChild("ProgressBar")
  35. local barBackground = progressBar and progressBar:FindFirstChild("BarBackground")
  36. local greenZone = barBackground and barBackground:FindFirstChild("GreenZone")
  37. local indicator = barBackground and barBackground:FindFirstChild("Indicator")
  38. local clickButton = mainFrame:FindFirstChild("ClickButton")
  39. local feedbackLabel = mainFrame:FindFirstChild("FeedbackLabel")
  40. local attemptsLabel = mainFrame:FindFirstChild("AttemptsLabel")
  41.  
  42. if not (indicator and greenZone and clickButton) then
  43. warn("โŒ Missing UI elements!")
  44. return
  45. end
  46.  
  47. print("โœ“ UI Elements loaded")
  48.  
  49. -- Get events
  50. task.wait(1)
  51. local eventsFolder = ReplicatedStorage:FindFirstChild("SneakerEvents")
  52. if not eventsFolder then
  53. warn("โŒ SneakerEvents folder missing!")
  54. return
  55. end
  56.  
  57. local brushingCompleteEvent = eventsFolder:FindFirstChild("BrushingComplete")
  58. local startBrushingEvent = eventsFolder:FindFirstChild("StartBrushing")
  59.  
  60. if not (brushingCompleteEvent and startBrushingEvent) then
  61. warn("โŒ Events missing!")
  62. return
  63. end
  64.  
  65. print("โœ“ Events connected")
  66.  
  67. --โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
  68. -- GAME STATE
  69. --โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
  70. local isPlaying = false
  71. local successfulHits = 0
  72. local indicatorPos = 0
  73. local direction = 1
  74. local animationRunning = false
  75.  
  76. --โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
  77. -- FUNCTIONS
  78. --โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
  79. local function PositionGreenZone()
  80. local maxPos = 1 - GREEN_ZONE_SIZE
  81. local randomPos = math.random() * maxPos
  82. greenZone.Position = UDim2.new(randomPos, 0, 0, 0)
  83. greenZone.Size = UDim2.new(GREEN_ZONE_SIZE, 0, 1, 0)
  84. print("๐ŸŸข Green zone at:", math.floor(randomPos * 100) .. "%")
  85. end
  86.  
  87. local function IsInGreenZone()
  88. local greenStart = greenZone.Position.X.Scale
  89. local greenEnd = greenStart + GREEN_ZONE_SIZE
  90. return indicatorPos >= greenStart and indicatorPos <= greenEnd
  91. end
  92.  
  93. local function ShowFeedback(msg, success)
  94. feedbackLabel.Text = msg
  95. feedbackLabel.TextColor3 = success and Color3.fromRGB(0, 255, 0) or Color3.fromRGB(255, 0, 0)
  96. feedbackLabel.Visible = true
  97. task.delay(1, function()
  98. feedbackLabel.Visible = false
  99. end)
  100. end
  101.  
  102. local function UpdateAttempts()
  103. attemptsLabel.Text = "Progress: " .. successfulHits .. "/" .. SUCCESS_ATTEMPTS
  104. end
  105.  
  106. local function AnimateIndicator()
  107. animationRunning = true
  108. print("โ–ถ๏ธ Animation started")
  109.  
  110. task.spawn(function()
  111. while animationRunning and isPlaying do
  112. indicatorPos = indicatorPos + (INDICATOR_SPEED * direction)
  113.  
  114. if indicatorPos >= 1 then
  115. indicatorPos = 1
  116. direction = -1
  117. elseif indicatorPos <= 0 then
  118. indicatorPos = 0
  119. direction = 1
  120. end
  121.  
  122. indicator.Position = UDim2.new(indicatorPos, 0, 0, 0)
  123. task.wait()
  124. end
  125. end)
  126. end
  127.  
  128. local function StopAnimation()
  129. animationRunning = false
  130. print("โน๏ธ Animation stopped")
  131. end
  132.  
  133. local function OnClick()
  134. if not isPlaying then
  135. print("โš ๏ธ Not playing - click ignored")
  136. return
  137. end
  138.  
  139. print("๐Ÿ–ฑ๏ธ Click at:", math.floor(indicatorPos * 100) .. "%")
  140.  
  141. if IsInGreenZone() then
  142. -- SUCCESS!
  143. successfulHits = successfulHits + 1
  144. ShowFeedback("PERFECT! โœ“", true)
  145. UpdateAttempts()
  146. print("โœ… Hit " .. successfulHits .. "/" .. SUCCESS_ATTEMPTS)
  147.  
  148. if successfulHits >= SUCCESS_ATTEMPTS then
  149. -- COMPLETE!
  150. print("๐ŸŽ‰ MINIGAME COMPLETE!")
  151. isPlaying = false
  152. StopAnimation()
  153. feedbackLabel.Text = "BRUSHING COMPLETE! ๐ŸŽ‰"
  154. feedbackLabel.TextColor3 = Color3.fromRGB(255, 215, 0)
  155. feedbackLabel.Visible = true
  156. brushingCompleteEvent:FireServer()
  157. task.wait(2)
  158. gui.Enabled = false
  159. mainFrame.Visible = false
  160.  
  161. task.wait(0.5)
  162. successfulHits = 0
  163. indicatorPos = 0
  164. direction = 1
  165. feedbackLabel.Visible = false
  166. UpdateAttempts()
  167. else
  168. task.wait(0.5)
  169. PositionGreenZone()
  170. end
  171. else
  172. -- MISS
  173. ShowFeedback("Miss! Try Again", false)
  174. print("โŒ Missed")
  175. end
  176. end
  177.  
  178. local function StartGame()
  179. print("\nโ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•—")
  180. print("โ•‘ ๐ŸŽฎ STARTING BRUSHING MINIGAME โ•‘")
  181. print("โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•")
  182.  
  183. isPlaying = false
  184. successfulHits = 0
  185. indicatorPos = 0
  186. direction = 1
  187. feedbackLabel.Visible = false
  188. animationRunning = false
  189.  
  190. isPlaying = true
  191. gui.Enabled = true
  192. mainFrame.Visible = true
  193. PositionGreenZone()
  194. UpdateAttempts()
  195. AnimateIndicator()
  196. titleLabel.Text = "Click when indicator is in GREEN!"
  197. print("โœ“ Ready to play!")
  198. print("โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•\n")
  199. end
  200.  
  201. --โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
  202. -- INPUT HANDLING (MOUSE/TOUCH/GAMEPAD)
  203. --โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
  204. -- Mouse/Touch click
  205. clickButton.MouseButton1Click:Connect(OnClick)
  206. print("โœ“ Click connected")
  207.  
  208. -- Block SPACE key from jumping during minigame (only trigger ONCE on press)
  209. local spacePressed = false
  210. ContextActionService:BindAction(
  211. "BlockBrushingSpace",
  212. function(actionName, inputState, inputObject)
  213. if isPlaying then
  214. if inputState == Enum.UserInputState.Begin and not spacePressed then
  215. spacePressed = true
  216. OnClick()
  217. elseif inputState == Enum.UserInputState.End then
  218. spacePressed = false
  219. end
  220. return Enum.ContextActionResult.Sink -- Block the input
  221. end
  222. return Enum.ContextActionResult.Pass
  223. end,
  224. false,
  225. Enum.KeyCode.Space,
  226. Enum.KeyCode.Return
  227. )
  228.  
  229. -- Gamepad support (A button on Xbox, Cross on PlayStation)
  230. ContextActionService:BindAction(
  231. "BrushingGamepadClick",
  232. function(actionName, inputState, inputObject)
  233. if inputState == Enum.UserInputState.Begin and isPlaying then
  234. OnClick()
  235. end
  236. return Enum.ContextActionResult.Sink
  237. end,
  238. false,
  239. Enum.KeyCode.ButtonA
  240. )
  241.  
  242. print("โœ“ Gamepad support enabled")
  243.  
  244. --โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
  245. -- EVENT CONNECTIONS
  246. --โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
  247. startBrushingEvent.OnClientEvent:Connect(function()
  248. print("๐Ÿ“ก START BRUSHING EVENT RECEIVED")
  249. StartGame()
  250. end)
  251.  
  252. print("โœ“ Start event connected")
  253.  
  254. --โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
  255. -- INIT
  256. --โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
  257. gui.Enabled = false
  258. mainFrame.Visible = false
  259. feedbackLabel.Visible = false
  260. UpdateAttempts()
  261. print("โœ… BRUSHING MINIGAME SCRIPT LOADED")
  262. print(" Speed:", INDICATOR_SPEED)
  263. print(" Zone Size:", GREEN_ZONE_SIZE * 100 .. "%")
  264. print(" Required Hits:", SUCCESS_ATTEMPTS)
  265. print("")
  266.  
  267. -COMPLETIONPOPUPGUI
  268. -- StarterGui > CompletionPopupGui > LocalScript
  269. -- Shows reward when sneaker is completed
  270.  
  271. print("๐Ÿ’ฐ Loading Completion Popup...")
  272.  
  273. --โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
  274. -- SETUP
  275. --โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
  276.  
  277. local Players = game:GetService("Players")
  278. local ReplicatedStorage = game:GetService("ReplicatedStorage")
  279. local TweenService = game:GetService("TweenService")
  280.  
  281. local player = Players.LocalPlayer
  282. local gui = script.Parent
  283.  
  284. -- UI Elements
  285. local popupFrame = gui:WaitForChild("PopupFrame", 5)
  286. if not popupFrame then
  287. warn("โŒ PopupFrame missing!")
  288. return
  289. end
  290.  
  291. local titleLabel = popupFrame:FindFirstChild("TitleLabel")
  292. local rarityLabel = popupFrame:FindFirstChild("RarityLabel")
  293. local rewardLabel = popupFrame:FindFirstChild("RewardLabel")
  294. local messageLabel = popupFrame:FindFirstChild("MessageLabel")
  295.  
  296. if not (titleLabel and rarityLabel and rewardLabel) then
  297. warn("โŒ Missing UI elements!")
  298. return
  299. end
  300.  
  301. print("โœ“ UI Elements loaded")
  302.  
  303. -- Get event
  304. local eventsFolder = ReplicatedStorage:WaitForChild("SneakerEvents", 10)
  305. if not eventsFolder then
  306. warn("โŒ SneakerEvents folder missing!")
  307. return
  308. end
  309.  
  310. local completedEvent = eventsFolder:FindFirstChild("SneakerCompleted")
  311. if not completedEvent then
  312. -- Create it if it doesn't exist
  313. completedEvent = Instance.new("RemoteEvent")
  314. completedEvent.Name = "SneakerCompleted"
  315. completedEvent.Parent = eventsFolder
  316. end
  317.  
  318. print("โœ“ Event connected")
  319.  
  320. --โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
  321. -- RARITY COLORS
  322. --โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
  323.  
  324. local RARITY_COLORS = {
  325. Common = Color3.fromRGB(180, 180, 180),
  326. Rare = Color3.fromRGB(100, 150, 255),
  327. Epic = Color3.fromRGB(200, 100, 255),
  328. Legendary = Color3.fromRGB(255, 200, 50)
  329. }
  330.  
  331. --โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
  332. -- FUNCTIONS
  333. --โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
  334.  
  335. local function ShowPopup(rarity, reward)
  336. print("๐ŸŽ‰ Showing completion popup")
  337. print(" Rarity:", rarity)
  338. print(" Reward:", reward)
  339.  
  340. -- Set content
  341. titleLabel.Text = "SNEAKER CLEANED!"
  342. rarityLabel.Text = rarity .. " Sneaker"
  343. rarityLabel.TextColor3 = RARITY_COLORS[rarity] or RARITY_COLORS.Common
  344. rewardLabel.Text = "+" .. reward .. " Coins"
  345.  
  346. if messageLabel then
  347. local messages = {
  348. Common = "Good work!",
  349. Rare = "Nice job!",
  350. Epic = "Excellent work!",
  351. Legendary = "AMAZING! What a shine!"
  352. }
  353. messageLabel.Text = messages[rarity] or "Well done!"
  354. end
  355.  
  356. -- Start hidden and scaled down
  357. popupFrame.Position = UDim2.new(0.5, 0, 0.5, 0)
  358. popupFrame.AnchorPoint = Vector2.new(0.5, 0.5)
  359. popupFrame.Size = UDim2.new(0, 0, 0, 0)
  360. popupFrame.Visible = true
  361.  
  362. -- Animate in (scale up)
  363. local tweenIn = TweenService:Create(
  364. popupFrame,
  365. TweenInfo.new(0.4, Enum.EasingStyle.Back, Enum.EasingDirection.Out),
  366. {Size = UDim2.new(0.4, 0, 0.4, 0)}
  367. )
  368. tweenIn:Play()
  369. tweenIn.Completed:Wait()
  370.  
  371. -- Hold for 3 seconds
  372. task.wait(3)
  373.  
  374. -- Animate out (scale down and fade)
  375. local tweenOut = TweenService:Create(
  376. popupFrame,
  377. TweenInfo.new(0.3, Enum.EasingStyle.Quad, Enum.EasingDirection.In),
  378. {
  379. Size = UDim2.new(0, 0, 0, 0),
  380. BackgroundTransparency = 1
  381. }
  382. )
  383.  
  384. -- Fade text too
  385. for _, child in ipairs(popupFrame:GetChildren()) do
  386. if child:IsA("TextLabel") then
  387. TweenService:Create(child, TweenInfo.new(0.3), {TextTransparency = 1}):Play()
  388. end
  389. end
  390.  
  391. tweenOut:Play()
  392. tweenOut.Completed:Wait()
  393.  
  394. -- Hide and reset
  395. popupFrame.Visible = false
  396. popupFrame.BackgroundTransparency = 0
  397.  
  398. for _, child in ipairs(popupFrame:GetChildren()) do
  399. if child:IsA("TextLabel") then
  400. child.TextTransparency = 0
  401. end
  402. end
  403.  
  404. print("โœ“ Popup closed")
  405. end
  406.  
  407. --โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
  408. -- EVENT CONNECTION
  409. --โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
  410.  
  411. completedEvent.OnClientEvent:Connect(function(rarity, reward)
  412. ShowPopup(rarity, reward)
  413. end)
  414.  
  415. print("โœ“ Completion event connected")
  416.  
  417. --โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
  418. -- INITIALIZATION
  419. --โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
  420.  
  421. popupFrame.Visible = false
  422.  
  423. wwwweprint("โœ… COMPLETION POPUP LOADED\n")
  424.  
  425. -PACKAGINGMINIGAMEGUI
  426. -- StarterGui > PackagingMinigameGui > LocalScript
  427. -- MOBILE/PC/CONSOLE COMPATIBLE - On-screen buttons + keyboard support
  428. -- FIXED: GUI updates properly after each correct key press
  429.  
  430. print("๐Ÿ“ฆ Loading Packaging Minigame...")
  431.  
  432. --โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
  433. -- CONFIGURATION
  434. --โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
  435. local SEQUENCE_LENGTH = 5 -- Number of buttons to press
  436. local TIME_PER_BUTTON = 5 -- Seconds to press each button
  437. local BUTTON_KEYS = {"W", "A", "S", "D"} -- Available keys for PC
  438.  
  439. -- Console button mapping (A=Q, B=W, X=E, Y=R)
  440. -- Change these to customize console controls
  441. local CONSOLE_BUTTON_KEYS = {
  442. Enum.KeyCode.ButtonA, -- Maps to Q
  443. Enum.KeyCode.ButtonB, -- Maps to W
  444. Enum.KeyCode.ButtonX, -- Maps to E
  445. Enum.KeyCode.ButtonY -- Maps to R
  446. }
  447.  
  448. --โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
  449. -- SETUP
  450. --โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
  451. local Players = game:GetService("Players")
  452. local ReplicatedStorage = game:GetService("ReplicatedStorage")
  453. local UserInputService = game:GetService("UserInputService")
  454. local ContextActionService = game:GetService("ContextActionService")
  455.  
  456. local player = Players.LocalPlayer
  457. local gui = script.Parent
  458.  
  459. -- UI Elements
  460. local mainFrame = gui:WaitForChild("MainFrame", 5)
  461. if not mainFrame then
  462. warn("โŒ MainFrame missing!")
  463. return
  464. end
  465.  
  466. local titleLabel = mainFrame:FindFirstChild("TitleLabel")
  467. local sequenceFrame = mainFrame:FindFirstChild("SequenceFrame")
  468. local currentKeyLabel = mainFrame:FindFirstChild("CurrentKeyLabel")
  469. local timerLabel = mainFrame:FindFirstChild("TimerLabel")
  470. local progressLabel = mainFrame:FindFirstChild("ProgressLabel")
  471. local instructionLabel = mainFrame:FindFirstChild("InstructionLabel")
  472. local buttonsContainer = mainFrame:FindFirstChild("ButtonsContainer")
  473.  
  474. if not (sequenceFrame and currentKeyLabel and timerLabel and progressLabel) then
  475. warn("โŒ Missing UI elements!")
  476. return
  477. end
  478.  
  479. print("โœ“ UI Elements loaded")
  480.  
  481. -- Events
  482. local eventsFolder = ReplicatedStorage:WaitForChild("SneakerEvents", 10)
  483. if not eventsFolder then
  484. warn("โŒ SneakerEvents folder missing!")
  485. return
  486. end
  487.  
  488. local packagingCompleteEvent = eventsFolder:WaitForChild("PackagingComplete", 5)
  489. local startPackagingEvent = eventsFolder:WaitForChild("StartPackaging", 5)
  490.  
  491. if not (packagingCompleteEvent and startPackagingEvent) then
  492. warn("โŒ Events missing!")
  493. return
  494. end
  495.  
  496. print("โœ“ Events connected")
  497.  
  498. --โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
  499. -- GAME STATE
  500. --โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
  501. local isPlaying = false
  502. local sequence = {}
  503. local currentStep = 1
  504. local timeRemaining = 0
  505. local timerRunning = false
  506. local onScreenButtons = {} -- Store button references
  507. local keyboardActionBound = false -- Track if keyboard action is bound
  508.  
  509. --โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
  510. -- HELPER FUNCTIONS
  511. --โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
  512. local function IsOnMobile()
  513. return UserInputService:GetLastInputType() == Enum.UserInputType.Touch
  514. end
  515.  
  516. local function BlockProximityPrompts(block)
  517. if block then
  518. ContextActionService:BindAction(
  519. "BlockPackagingInput",
  520. function(actionName, inputState, inputObject)
  521. return Enum.ContextActionResult.Sink
  522. end,
  523. false,
  524. Enum.KeyCode.E
  525. )
  526. print("๐Ÿ”’ Blocked proximity prompt interactions")
  527. else
  528. ContextActionService:UnbindAction("BlockPackagingInput")
  529. print("๐Ÿ”“ Unblocked proximity prompt interactions")
  530. end
  531. end
  532.  
  533. local function UnbindKeyboardAction()
  534. if keyboardActionBound then
  535. ContextActionService:UnbindAction("PackagingKeyboardInput")
  536. keyboardActionBound = false
  537. print("๐Ÿ”“ Unblocked movement keys (W/A/S/D)")
  538. end
  539. end
  540.  
  541. --โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
  542. -- ON-SCREEN BUTTON CREATION (MOBILE ONLY)
  543. --โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
  544. local function CreateOnScreenButtons()
  545. -- Only show buttons on mobile
  546. if not IsOnMobile() then
  547. print("โ„น๏ธ PC/Console detected - skipping on-screen buttons")
  548. return
  549. end
  550.  
  551. -- Create or get buttons container
  552. if not buttonsContainer then
  553. buttonsContainer = Instance.new("Frame")
  554. buttonsContainer.Name = "ButtonsContainer"
  555. buttonsContainer.Size = UDim2.new(1, 0, 0.25, 0)
  556. buttonsContainer.Position = UDim2.new(0, 0, 0.75, 0)
  557. buttonsContainer.BackgroundTransparency = 1
  558. buttonsContainer.Parent = mainFrame
  559. end
  560.  
  561. -- Clear old buttons
  562. for _, btn in ipairs(buttonsContainer:GetChildren()) do
  563. if btn:IsA("TextButton") then
  564. btn:Destroy()
  565. end
  566. end
  567.  
  568. -- Create buttons for each key
  569. local buttonWidth = 1 / #BUTTON_KEYS
  570. for i, key in ipairs(BUTTON_KEYS) do
  571. local button = Instance.new("TextButton")
  572. button.Name = "Key_" .. key
  573. button.Text = key
  574. button.Size = UDim2.new(buttonWidth - 0.02, 0, 0.8, 0)
  575. button.Position = UDim2.new((i - 1) * buttonWidth + 0.01, 0, 0.1, 0)
  576. button.BackgroundColor3 = Color3.fromRGB(0, 100, 200)
  577. button.TextColor3 = Color3.new(1, 1, 1)
  578. button.TextScaled = true
  579. button.Font = Enum.Font.GothamBold
  580. button.Parent = buttonsContainer
  581.  
  582. -- Add corner effect
  583. local corner = Instance.new("UICorner")
  584. corner.CornerRadius = UDim.new(0, 8)
  585. corner.Parent = button
  586.  
  587. -- Store reference
  588. onScreenButtons[key] = button
  589.  
  590. -- Connect button press (will call OnKeyPress after it's defined)
  591. button.MouseButton1Click:Connect(function()
  592. if OnKeyPress then
  593. OnKeyPress(key)
  594. end
  595. end)
  596. end
  597.  
  598. print("โœ“ On-screen buttons created (Mobile only)")
  599. end
  600.  
  601. --โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
  602. -- DISPLAY UPDATE FUNCTIONS (MOVED BEFORE OnKeyPress)
  603. --โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
  604. local function GenerateSequence()
  605. sequence = {}
  606. for i = 1, SEQUENCE_LENGTH do
  607. local randomKey = BUTTON_KEYS[math.random(1, #BUTTON_KEYS)]
  608. table.insert(sequence, randomKey)
  609. end
  610. print("๐ŸŽฏ Generated sequence:", table.concat(sequence, " โ†’ "))
  611. return sequence
  612. end
  613.  
  614. local function DisplaySequence()
  615. -- Clear old sequence
  616. for _, child in ipairs(sequenceFrame:GetChildren()) do
  617. if child:IsA("TextLabel") then
  618. child:Destroy()
  619. end
  620. end
  621.  
  622. -- Create sequence display
  623. for i, key in ipairs(sequence) do
  624. local keyLabel = Instance.new("TextLabel")
  625. keyLabel.Size = UDim2.new(0.15, 0, 0.8, 0)
  626. keyLabel.Position = UDim2.new((i - 1) * 0.18 + 0.05, 0, 0.1, 0)
  627. keyLabel.Text = key
  628. keyLabel.TextScaled = true
  629. keyLabel.Font = Enum.Font.GothamBold
  630. keyLabel.BackgroundColor3 = Color3.fromRGB(60, 60, 60)
  631. keyLabel.TextColor3 = Color3.new(1, 1, 1)
  632. keyLabel.BorderSizePixel = 2
  633. keyLabel.BorderColor3 = Color3.fromRGB(100, 100, 100)
  634. keyLabel.Parent = sequenceFrame
  635.  
  636. -- Highlight current step
  637. if i == currentStep then
  638. keyLabel.BackgroundColor3 = Color3.fromRGB(0, 200, 100)
  639. keyLabel.BorderColor3 = Color3.fromRGB(0, 255, 150)
  640. elseif i < currentStep then
  641. keyLabel.BackgroundColor3 = Color3.fromRGB(100, 100, 100)
  642. keyLabel.TextTransparency = 0.5
  643. end
  644. end
  645. print("๐Ÿ“Š Sequence display updated - Current step:", currentStep)
  646. end
  647.  
  648. local function UpdateDisplay()
  649. if currentStep <= #sequence then
  650. currentKeyLabel.Text = "Press: " .. sequence[currentStep]
  651. currentKeyLabel.TextColor3 = Color3.fromRGB(255, 255, 0)
  652. end
  653. progressLabel.Text = string.format("Step %d / %d", currentStep, SEQUENCE_LENGTH)
  654. DisplaySequence()
  655. end
  656.  
  657. local function UpdateButtonVisuals()
  658. -- Highlight the current expected button
  659. for key, button in pairs(onScreenButtons) do
  660. if key == sequence[currentStep] then
  661. button.BackgroundColor3 = Color3.fromRGB(255, 255, 0)
  662. else
  663. button.BackgroundColor3 = Color3.fromRGB(0, 100, 200)
  664. end
  665. end
  666. end
  667.  
  668. local function StartTimer()
  669. timerRunning = true
  670. timeRemaining = TIME_PER_BUTTON
  671.  
  672. task.spawn(function()
  673. while timerRunning and isPlaying and timeRemaining > 0 do
  674. timeRemaining = timeRemaining - (1/60)
  675. timerLabel.Text = string.format("Time: %.1fs", math.max(0, timeRemaining))
  676.  
  677. -- Color based on time
  678. if timeRemaining < 0.5 then
  679. timerLabel.TextColor3 = Color3.fromRGB(255, 50, 50)
  680. elseif timeRemaining < 1 then
  681. timerLabel.TextColor3 = Color3.fromRGB(255, 200, 50)
  682. else
  683. timerLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
  684. end
  685.  
  686. task.wait()
  687. end
  688.  
  689. -- Time ran out
  690. if isPlaying and timeRemaining <= 0 then
  691. print("โŒ Time ran out!")
  692. FailMinigame()
  693. end
  694. end)
  695. end
  696.  
  697. --โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
  698. -- MINIGAME FUNCTIONS (DEFINED EARLY FOR CONTEXT ACTION SERVICE)
  699. --โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
  700. function OnKeyPress(key)
  701. if not isPlaying then return end
  702. if currentStep > #sequence then return end
  703.  
  704. local expectedKey = sequence[currentStep]
  705. print("๐Ÿ”‘ Pressed:", key, "| Expected:", expectedKey)
  706.  
  707. if key == expectedKey then
  708. -- CORRECT!
  709. print("โœ… Correct! Step", currentStep, "of", SEQUENCE_LENGTH)
  710.  
  711. -- Flash button green
  712. if onScreenButtons[key] then
  713. onScreenButtons[key].BackgroundColor3 = Color3.fromRGB(0, 255, 0)
  714. task.delay(0.2, function()
  715. if onScreenButtons[key] then
  716. onScreenButtons[key].BackgroundColor3 = Color3.fromRGB(0, 100, 200)
  717. end
  718. end)
  719. end
  720.  
  721. -- Flash label green
  722. currentKeyLabel.TextColor3 = Color3.fromRGB(0, 255, 0)
  723. task.delay(0.2, function()
  724. if currentKeyLabel then
  725. currentKeyLabel.TextColor3 = Color3.fromRGB(255, 255, 0)
  726. end
  727. end)
  728.  
  729. currentStep = currentStep + 1
  730. print("๐Ÿ“ˆ Current step is now:", currentStep)
  731.  
  732. if currentStep > SEQUENCE_LENGTH then
  733. -- COMPLETE!
  734. print("๐ŸŽ‰ ALL STEPS COMPLETE!")
  735. CompleteMinigame()
  736. else
  737. -- Next step - UPDATE UI IMMEDIATELY
  738. task.wait(0.5)
  739. print("๐Ÿ”„ Updating display for next step...")
  740. UpdateDisplay()
  741. UpdateButtonVisuals()
  742. StartTimer()
  743. end
  744. else
  745. -- WRONG!
  746. print("โŒ Wrong key!")
  747.  
  748. -- Flash button red
  749. if onScreenButtons[key] then
  750. onScreenButtons[key].BackgroundColor3 = Color3.fromRGB(255, 0, 0)
  751. task.delay(0.2, function()
  752. if onScreenButtons[key] then
  753. onScreenButtons[key].BackgroundColor3 = Color3.fromRGB(0, 100, 200)
  754. end
  755. end)
  756. end
  757.  
  758. -- Flash label red
  759. currentKeyLabel.TextColor3 = Color3.fromRGB(255, 0, 0)
  760. task.delay(0.2, function()
  761. if currentKeyLabel then
  762. currentKeyLabel.TextColor3 = Color3.fromRGB(255, 255, 0)
  763. end
  764. end)
  765. end
  766. end
  767.  
  768. function CompleteMinigame()
  769. print("๐ŸŽ‰ Packaging complete!")
  770. isPlaying = false
  771. timerRunning = false
  772. UnbindKeyboardAction()
  773. BlockProximityPrompts(false)
  774. currentKeyLabel.Text = "PACKAGING COMPLETE! ๐ŸŽ‰"
  775. currentKeyLabel.TextColor3 = Color3.fromRGB(0, 255, 0)
  776. timerLabel.Text = "Success!"
  777. instructionLabel.Text = "Sneaker ready for delivery!"
  778. packagingCompleteEvent:FireServer()
  779. print(" โœ“ Sent completion to server")
  780. task.wait(2)
  781. gui.Enabled = false
  782. mainFrame.Visible = false
  783. task.wait(0.5)
  784. ResetMinigame()
  785. end
  786.  
  787. function FailMinigame()
  788. print("โŒ Failed packaging!")
  789. isPlaying = false
  790. timerRunning = false
  791. UnbindKeyboardAction()
  792. BlockProximityPrompts(false)
  793. currentKeyLabel.Text = "TIME'S UP!"
  794. currentKeyLabel.TextColor3 = Color3.fromRGB(255, 0, 0)
  795. timerLabel.Text = "Failed"
  796. instructionLabel.Text = "Try again!"
  797. task.wait(2)
  798. -- Restart
  799. StartMinigame()
  800. end
  801.  
  802. function ResetMinigame()
  803. isPlaying = false
  804. sequence = {}
  805. currentStep = 1
  806. timeRemaining = 0
  807. timerRunning = false
  808. print(" ๐Ÿ”„ Minigame reset")
  809. end
  810.  
  811. function StartMinigame()
  812. print("\nโ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•—")
  813. print("โ•‘ ๐Ÿ“ฆ STARTING PACKAGING MINIGAME โ•‘")
  814. print("โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•")
  815.  
  816. ResetMinigame()
  817. isPlaying = true
  818.  
  819. -- BIND KEYBOARD ACTION (This must happen BEFORE BindKeyboardAction function, so it works properly)
  820. if not keyboardActionBound then
  821. ContextActionService:BindAction(
  822. "PackagingKeyboardInput",
  823. function(actionName, inputState, inputObject)
  824. if not isPlaying then return end
  825.  
  826. if inputState == Enum.UserInputState.Begin then
  827. for _, key in ipairs(BUTTON_KEYS) do
  828. if inputObject.KeyCode == Enum.KeyCode[key] then
  829. OnKeyPress(key)
  830. break
  831. end
  832. end
  833. end
  834.  
  835. return Enum.ContextActionResult.Sink
  836. end,
  837. false,
  838. Enum.KeyCode.Q,
  839. Enum.KeyCode.W,
  840. Enum.KeyCode.E,
  841. Enum.KeyCode.R,
  842. Enum.KeyCode.A,
  843. Enum.KeyCode.S,
  844. Enum.KeyCode.D,
  845. Enum.KeyCode.F
  846. )
  847. keyboardActionBound = true
  848. print("๐Ÿ”’ Blocked movement keys (W/A/S/D)")
  849. end
  850.  
  851. BlockProximityPrompts(true)
  852. gui.Enabled = true
  853. mainFrame.Visible = true
  854. GenerateSequence()
  855. currentStep = 1
  856. CreateOnScreenButtons()
  857. UpdateDisplay()
  858. UpdateButtonVisuals()
  859. StartTimer()
  860. titleLabel.Text = "Package the Sneaker!"
  861. instructionLabel.Text = "Tap/Click the buttons in order before time runs out!"
  862. print("โœ“ Ready to play!")
  863. print("โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•\n")
  864. end
  865.  
  866. --โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
  867. -- INPUT HANDLING (GAMEPAD)
  868. --โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
  869. -- Gamepad support (face buttons) - CUSTOMIZABLE
  870. local gamepadButtons = {
  871. [Enum.KeyCode.ButtonA] = "Q", -- Press A to press Q
  872. [Enum.KeyCode.ButtonB] = "W", -- Press B to press W
  873. [Enum.KeyCode.ButtonX] = "E", -- Press X to press E
  874. [Enum.KeyCode.ButtonY] = "R", -- Press Y to press R
  875. }
  876.  
  877. -- To customize console controls, change the mapping above:
  878. -- [Enum.KeyCode.ButtonA] = "Q" -- Press A to input Q
  879. -- [Enum.KeyCode.ButtonB] = "W" -- Press B to input W
  880. -- [Enum.KeyCode.ButtonX] = "E" -- Press X to input E
  881. -- [Enum.KeyCode.ButtonY] = "R" -- Press Y to input R
  882. -- You can also map them to different keys like:
  883. -- [Enum.KeyCode.ButtonA] = "1" -- Press A to input "1"
  884. -- [Enum.KeyCode.ButtonLB] = "Q" -- Press LB to input "Q"
  885.  
  886. ContextActionService:BindAction(
  887. "PackagingGamepadInput",
  888. function(actionName, inputState, inputObject)
  889. if inputState == Enum.UserInputState.Begin and isPlaying then
  890. local key = gamepadButtons[inputObject.KeyCode]
  891. if key then
  892. OnKeyPress(key)
  893. end
  894. end
  895. return Enum.ContextActionResult.Sink
  896. end,
  897. false,
  898. Enum.KeyCode.ButtonA,
  899. Enum.KeyCode.ButtonB,
  900. Enum.KeyCode.ButtonX,
  901. Enum.KeyCode.ButtonY
  902. )
  903.  
  904. print("โœ“ All input methods connected (Mouse, Touch, Keyboard, Gamepad)")
  905.  
  906. --โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
  907. -- EVENT CONNECTIONS
  908. --โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
  909. startPackagingEvent.OnClientEvent:Connect(function()
  910. print("๐Ÿ“ก START PACKAGING EVENT RECEIVED")
  911. StartMinigame()
  912. end)
  913.  
  914. print("โœ“ Start event connected")
  915.  
  916. --โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
  917. -- INITIALIZATION
  918. --โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
  919. gui.Enabled = false
  920. mainFrame.Visible = false
  921. print("โœ… PACKAGING MINIGAME LOADED")
  922. print(" Sequence Length:", SEQUENCE_LENGTH)
  923. print(" Time Per Key:", TIME_PER_BUTTON, "seconds")
  924. print(" Available Keys:", table.concat(BUTTON_KEYS, ", "))
  925. print("")
  926.  
  927. -RINSINGMINIGAMEGUI
  928. -- StarterGui > RinsingMinigameGui > LocalScript
  929. -- MOBILE/PC/CONSOLE COMPATIBLE - Hold button or press Space
  930. -- FIXED: Properly hides at startup, shows when called
  931.  
  932. print("๐Ÿšฟ Loading Rinsing Minigame...")
  933.  
  934. --โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
  935. -- CONFIGURATION
  936. --โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
  937. local SUCCESS_TIME = 5 -- Seconds to stay in zone
  938. local PRESSURE_SPEED = 0.010 -- How fast pressure changes
  939. local SAFE_ZONE_SIZE = 0.25 -- Size of safe zone (25% of bar)
  940. local PENALTY_TIME = 0.5 -- Time lost when outside zone
  941.  
  942. --โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
  943. -- SETUP
  944. --โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
  945. local Players = game:GetService("Players")
  946. local ReplicatedStorage = game:GetService("ReplicatedStorage")
  947. local UserInputService = game:GetService("UserInputService")
  948. local ContextActionService = game:GetService("ContextActionService")
  949.  
  950. local player = Players.LocalPlayer
  951. local gui = script.Parent
  952.  
  953. -- UI Elements
  954. local mainFrame = gui:WaitForChild("MainFrame", 5)
  955. if not mainFrame then
  956. warn("โŒ MainFrame missing!")
  957. return
  958. end
  959.  
  960. local titleLabel = mainFrame:FindFirstChild("TitleLabel")
  961. local pressureBar = mainFrame:FindFirstChild("PressureBar")
  962. local barBackground = pressureBar and pressureBar:FindFirstChild("BarBackground")
  963. local safeZone = barBackground and barBackground:FindFirstChild("SafeZone")
  964. local indicator = barBackground and barBackground:FindFirstChild("Indicator")
  965. local controlButton = mainFrame:FindFirstChild("ControlButton")
  966. local timerLabel = mainFrame:FindFirstChild("TimerLabel")
  967. local instructionLabel = mainFrame:FindFirstChild("InstructionLabel")
  968.  
  969. if not (indicator and safeZone and controlButton and timerLabel) then
  970. warn("โŒ Missing UI elements!")
  971. return
  972. end
  973.  
  974. print("โœ“ UI Elements loaded")
  975.  
  976. -- Events
  977. local eventsFolder = ReplicatedStorage:WaitForChild("SneakerEvents", 10)
  978. if not eventsFolder then
  979. warn("โŒ SneakerEvents folder missing!")
  980. return
  981. end
  982.  
  983. local rinsingCompleteEvent = eventsFolder:WaitForChild("RinsingComplete", 5)
  984. local startRinsingEvent = eventsFolder:WaitForChild("StartRinsing", 5)
  985.  
  986. if not (rinsingCompleteEvent and startRinsingEvent) then
  987. warn("โŒ Events missing!")
  988. return
  989. end
  990.  
  991. print("โœ“ Events connected")
  992.  
  993. --โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
  994. -- GAME STATE
  995. --โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
  996. local isPlaying = false
  997. local pressureLevel = 0.5 -- Start at middle
  998. local timeInZone = 0
  999. local isPressingButton = false
  1000. local animationRunning = false
  1001.  
  1002. --โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
  1003. -- FUNCTIONS
  1004. --โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
  1005. local function IsInSafeZone()
  1006. local safeStart = safeZone.Position.X.Scale
  1007. local safeEnd = safeStart + SAFE_ZONE_SIZE
  1008. return pressureLevel >= safeStart and pressureLevel <= safeEnd
  1009. end
  1010.  
  1011. local function UpdateTimer()
  1012. local progress = math.floor((timeInZone / SUCCESS_TIME) * 100)
  1013. timerLabel.Text = string.format("Time in Zone: %.1fs / %ds (%d%%)", timeInZone, SUCCESS_TIME, progress)
  1014.  
  1015. -- Color based on progress
  1016. if progress < 33 then
  1017. timerLabel.TextColor3 = Color3.fromRGB(255, 100, 100) -- Red
  1018. elseif progress < 66 then
  1019. timerLabel.TextColor3 = Color3.fromRGB(255, 255, 100) -- Yellow
  1020. else
  1021. timerLabel.TextColor3 = Color3.fromRGB(100, 255, 100) -- Green
  1022. end
  1023. end
  1024.  
  1025. local function PositionSafeZone()
  1026. local maxPos = 1 - SAFE_ZONE_SIZE
  1027. local randomPos = 0.3 + (math.random() * 0.4) -- Keep it somewhat centered
  1028. safeZone.Position = UDim2.new(randomPos, 0, 0, 0)
  1029. safeZone.Size = UDim2.new(SAFE_ZONE_SIZE, 0, 1, 0)
  1030. print("๐ŸŸข Safe zone at:", math.floor(randomPos * 100) .. "%")
  1031. end
  1032.  
  1033. local function AnimatePressure()
  1034. animationRunning = true
  1035. print("โ–ถ๏ธ Pressure simulation started")
  1036.  
  1037. task.spawn(function()
  1038. while animationRunning and isPlaying do
  1039. -- Pressure naturally rises
  1040. if isPressingButton then
  1041. -- Pressing lowers pressure
  1042. pressureLevel = pressureLevel - PRESSURE_SPEED * 1.5
  1043. else
  1044. -- Not pressing, pressure rises
  1045. pressureLevel = pressureLevel + PRESSURE_SPEED
  1046. end
  1047.  
  1048. -- Clamp to 0-1 range
  1049. pressureLevel = math.clamp(pressureLevel, 0, 1)
  1050.  
  1051. -- Update visual
  1052. indicator.Position = UDim2.new(pressureLevel, 0, 0, 0)
  1053.  
  1054. -- Check if in zone
  1055. if IsInSafeZone() then
  1056. timeInZone = timeInZone + (1/60)
  1057. -- Check win condition
  1058. if timeInZone >= SUCCESS_TIME then
  1059. CompleteMinigame()
  1060. break
  1061. end
  1062. else
  1063. -- Outside zone, lose time
  1064. timeInZone = math.max(0, timeInZone - PENALTY_TIME * (1/60))
  1065. end
  1066.  
  1067. UpdateTimer()
  1068. task.wait()
  1069. end
  1070. end)
  1071. end
  1072.  
  1073. local function StopAnimation()
  1074. animationRunning = false
  1075. print("โน๏ธ Pressure simulation stopped")
  1076. end
  1077.  
  1078. function CompleteMinigame()
  1079. print("๐ŸŽ‰ Rinsing complete!")
  1080. isPlaying = false
  1081. StopAnimation()
  1082. timerLabel.Text = "RINSING COMPLETE! ๐ŸŽ‰"
  1083. timerLabel.TextColor3 = Color3.fromRGB(0, 255, 0)
  1084. instructionLabel.Text = "Perfect! Sneaker is clean!"
  1085. rinsingCompleteEvent:FireServer()
  1086. print(" โœ“ Sent completion to server")
  1087. task.wait(2)
  1088. gui.Enabled = false
  1089. mainFrame.Visible = false
  1090. task.wait(0.5)
  1091. ResetMinigame()
  1092. end
  1093.  
  1094. function ResetMinigame()
  1095. isPlaying = false
  1096. pressureLevel = 0.5
  1097. timeInZone = 0
  1098. isPressingButton = false
  1099. animationRunning = false
  1100. indicator.Position = UDim2.new(0.5, 0, 0, 0)
  1101. UpdateTimer()
  1102. print(" ๐Ÿ”„ Minigame reset")
  1103. end
  1104.  
  1105. function StartMinigame()
  1106. print("\nโ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•—")
  1107. print("โ•‘ ๐Ÿšฟ STARTING RINSING MINIGAME โ•‘")
  1108. print("โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•")
  1109.  
  1110. ResetMinigame()
  1111. isPlaying = true
  1112. gui.Enabled = true
  1113. mainFrame.Visible = true
  1114. PositionSafeZone()
  1115. UpdateTimer()
  1116. AnimatePressure()
  1117. titleLabel.Text = "Keep pressure in GREEN zone!"
  1118. instructionLabel.Text = "Hold SPACE or click button to control pressure"
  1119. print("โœ“ Ready to play!")
  1120. print("โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•\n")
  1121. end
  1122.  
  1123. --โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
  1124. -- INPUT HANDLING (MOUSE/TOUCH/KEYBOARD/GAMEPAD)
  1125. --โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
  1126. -- Mouse button (PC)
  1127. controlButton.MouseButton1Down:Connect(function()
  1128. if isPlaying then
  1129. isPressingButton = true
  1130. controlButton.BackgroundColor3 = Color3.fromRGB(100, 200, 255)
  1131. end
  1132. end)
  1133.  
  1134. controlButton.MouseButton1Up:Connect(function()
  1135. isPressingButton = false
  1136. controlButton.BackgroundColor3 = Color3.fromRGB(0, 150, 255)
  1137. end)
  1138.  
  1139. -- Keyboard support (SPACE and other keys) - BLOCKS JUMP
  1140. ContextActionService:BindAction(
  1141. "RinsingKeyboardControl",
  1142. function(actionName, inputState, inputObject)
  1143. if not isPlaying then return end
  1144.  
  1145. if inputState == Enum.UserInputState.Begin then
  1146. isPressingButton = true
  1147. controlButton.BackgroundColor3 = Color3.fromRGB(100, 200, 255)
  1148. elseif inputState == Enum.UserInputState.End then
  1149. isPressingButton = false
  1150. controlButton.BackgroundColor3 = Color3.fromRGB(0, 150, 255)
  1151. end
  1152.  
  1153. return Enum.ContextActionResult.Sink -- Block the input
  1154. end,
  1155. false,
  1156. Enum.KeyCode.Space,
  1157. Enum.KeyCode.E,
  1158. Enum.KeyCode.Return
  1159. )
  1160.  
  1161. -- Gamepad support (hold trigger or button)
  1162. ContextActionService:BindAction(
  1163. "RinsingGamepadHold",
  1164. function(actionName, inputState, inputObject)
  1165. if not isPlaying then return end
  1166.  
  1167. if inputState == Enum.UserInputState.Begin then
  1168. isPressingButton = true
  1169. controlButton.BackgroundColor3 = Color3.fromRGB(100, 200, 255)
  1170. elseif inputState == Enum.UserInputState.End then
  1171. isPressingButton = false
  1172. controlButton.BackgroundColor3 = Color3.fromRGB(0, 150, 255)
  1173. end
  1174.  
  1175. return Enum.ContextActionResult.Sink
  1176. end,
  1177. false,
  1178. Enum.KeyCode.ButtonR2, -- Right trigger (hold)
  1179. Enum.KeyCode.ButtonA -- A button
  1180. )
  1181.  
  1182. print("โœ“ All input methods connected (Mouse, Keyboard, Gamepad)")
  1183.  
  1184. --โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
  1185. -- EVENT CONNECTIONS
  1186. --โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
  1187. startRinsingEvent.OnClientEvent:Connect(function()
  1188. print("๐Ÿ“ก START RINSING EVENT RECEIVED")
  1189. StartMinigame()
  1190. end)
  1191.  
  1192. print("โœ“ Start event connected")
  1193.  
  1194. --โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
  1195. -- INITIALIZATION
  1196. --โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
  1197. gui.Enabled = false
  1198. mainFrame.Visible = false
  1199. UpdateTimer()
  1200. print("โœ… RINSING MINIGAME LOADED")
  1201. print(" Success Time:", SUCCESS_TIME, "seconds")
  1202. print(" Safe Zone:", SAFE_ZONE_SIZE * 100 .. "%")
  1203. print("")
  1204.  
  1205. -SNEAKERTRACKERGUI
  1206. local Players = game:GetService("Players")
  1207. local ReplicatedStorage = game:GetService("ReplicatedStorage")
  1208. local TweenService = game:GetService("TweenService")
  1209.  
  1210. local player = Players.LocalPlayer
  1211. local gui = script.Parent
  1212.  
  1213. local mainFrame = gui:WaitForChild("MainFrame", 5)
  1214. local rarityLabel = mainFrame and mainFrame:WaitForChild("RarityLabel", 5)
  1215. local stageLabel = mainFrame and mainFrame:WaitForChild("StageLabel", 5)
  1216. local progressBar = mainFrame and mainFrame:WaitForChild("ProgressBar", 5)
  1217. local progressFill = progressBar and progressBar:WaitForChild("ProgressFill", 5)
  1218. local percentLabel = mainFrame and mainFrame:WaitForChild("PercentLabel", 5)
  1219. local noSneakerLabel = gui:WaitForChild("NoSneakerLabel", 5)
  1220.  
  1221. if not (mainFrame and rarityLabel and stageLabel and progressBar and progressFill and percentLabel and noSneakerLabel) then
  1222. warn("Tracker GUI elements missing!")
  1223. return
  1224. end
  1225.  
  1226. local STAGES = {
  1227. ["Received"] = {Text = "๐Ÿ“‹ Take to Brushing Station", Progress = 0, Color = Color3.fromRGB(150, 150, 150)},
  1228. ["Brushing"] = {Text = "๐Ÿงน Brushing in Progress...", Progress = 20, Color = Color3.fromRGB(100, 150, 255)},
  1229. ["BrushingDone"] = {Text = "โœ“ Take to Rinsing Station", Progress = 25, Color = Color3.fromRGB(0, 200, 100)},
  1230. ["Rinsing"] = {Text = "๐Ÿ’ง Rinsing in Progress...", Progress = 45, Color = Color3.fromRGB(100, 150, 255)},
  1231. ["RinsingDone"] = {Text = "โœ“ Take to Drying Station", Progress = 50, Color = Color3.fromRGB(0, 200, 100)},
  1232. ["Drying"] = {Text = "๐Ÿ’จ Drying in Progress...", Progress = 70, Color = Color3.fromRGB(100, 150, 255)},
  1233. ["DryingDone"] = {Text = "โœ“ Take to Packaging Station", Progress = 75, Color = Color3.fromRGB(0, 200, 100)},
  1234. ["Packaging"] = {Text = "๐Ÿ“ฆ Packaging in Progress...", Progress = 95, Color = Color3.fromRGB(100, 150, 255)},
  1235. ["Completed"] = {Text = "๐ŸŽ‰ Sneaker Complete!", Progress = 100, Color = Color3.fromRGB(255, 215, 0)}
  1236. }
  1237.  
  1238. local RARITY_COLORS = {
  1239. Common = Color3.fromRGB(180, 180, 180),
  1240. Rare = Color3.fromRGB(100, 150, 255),
  1241. Epic = Color3.fromRGB(200, 100, 255),
  1242. Legendary = Color3.fromRGB(255, 200, 50)
  1243. }
  1244.  
  1245. local function UpdateProgress(stage, rarity)
  1246. if not stage or stage == "" then
  1247. mainFrame.Visible = false
  1248. noSneakerLabel.Visible = true
  1249. return
  1250. end
  1251.  
  1252. mainFrame.Visible = true
  1253. noSneakerLabel.Visible = false
  1254.  
  1255. local stageInfo = STAGES[stage]
  1256. if not stageInfo then return end
  1257.  
  1258. rarityLabel.Text = (rarity or "Common") .. " Sneaker"
  1259. rarityLabel.TextColor3 = RARITY_COLORS[rarity] or RARITY_COLORS.Common
  1260.  
  1261. stageLabel.Text = stageInfo.Text
  1262. stageLabel.TextColor3 = stageInfo.Color
  1263.  
  1264. local targetSize = UDim2.new(stageInfo.Progress / 100, 0, 1, 0)
  1265. TweenService:Create(progressFill, TweenInfo.new(0.5), {Size = targetSize, BackgroundColor3 = stageInfo.Color}):Play()
  1266.  
  1267. percentLabel.Text = stageInfo.Progress .. "%"
  1268.  
  1269. if stage == "Completed" then
  1270. task.wait(2)
  1271. mainFrame.Visible = false
  1272. noSneakerLabel.Visible = true
  1273. end
  1274. end
  1275.  
  1276. local remoteEventsFolder = ReplicatedStorage:WaitForChild("SneakerEvents", 10)
  1277. if remoteEventsFolder then
  1278. local updateStageEvent = remoteEventsFolder:WaitForChild("UpdateStage", 5)
  1279. if updateStageEvent then
  1280. updateStageEvent.OnClientEvent:Connect(UpdateProgress)
  1281. end
  1282. end
  1283.  
  1284. mainFrame.Visible = false
  1285. noSneakerLabel.Visible = true
  1286.  
  1287. print("โœ“ Sneaker Tracker Loaded")
  1288.  
  1289. LOCALSCRIPTS IN STARTERPLAYER>STARTERPLAYERSCRIPTS
  1290. -INDEXCLIENT
  1291. --[[
  1292. INDEX CLIENT (LOCAL SCRIPT)
  1293. Location: StarterPlayer/StarterPlayerScripts/IndexClient
  1294.  
  1295. Purpose:
  1296. - Displays Sneaker Index UI
  1297. - Shows discovered/locked sneakers
  1298. - Handles filtering by rarity
  1299. - Updates when new sneakers are discovered
  1300. --]]
  1301.  
  1302. local Players = game:GetService("Players")
  1303. local ReplicatedStorage = game:GetService("ReplicatedStorage")
  1304. local TweenService = game:GetService("TweenService")
  1305.  
  1306. local player = Players.LocalPlayer
  1307. local playerGui = player:WaitForChild("PlayerGui")
  1308.  
  1309. -- ========================================
  1310. -- WAIT FOR UI ELEMENTS
  1311. -- ========================================
  1312.  
  1313. local indexUI = playerGui:WaitForChild("IndexUI")
  1314. local indexButton = indexUI:WaitForChild("IndexButton")
  1315. local indexPanel = indexUI:WaitForChild("IndexPanel")
  1316. local sneakerGrid = indexPanel:WaitForChild("SneakerGrid")
  1317. local filterFrame = indexPanel:WaitForChild("FilterFrame")
  1318. local progressText = indexPanel.Header:WaitForChild("ProgressText")
  1319.  
  1320. -- Get template
  1321. local Templates = ReplicatedStorage:WaitForChild("Templates")
  1322. local sneakerTemplate = Templates:WaitForChild("SneakerTemplate")
  1323.  
  1324. -- ========================================
  1325. -- MODULES & REMOTES
  1326. -- ========================================
  1327.  
  1328. local Modules = ReplicatedStorage:WaitForChild("Modules")
  1329. local SneakerData = require(Modules.SneakerData)
  1330.  
  1331. local RemoteEvents = ReplicatedStorage:WaitForChild("RemoteEvents")
  1332. local sneakerDiscovered = RemoteEvents:WaitForChild("SneakerDiscovered")
  1333.  
  1334. -- ========================================
  1335. -- STATE VARIABLES
  1336. -- ========================================
  1337.  
  1338. local discoveredSneakers = {} -- [sneakerId] = true
  1339. local currentFilter = "All"
  1340. local isPanelOpen = false
  1341.  
  1342. -- ========================================
  1343. -- TOGGLE INDEX PANEL
  1344. -- ========================================
  1345.  
  1346. local function togglePanel()
  1347. isPanelOpen = not isPanelOpen
  1348.  
  1349. if isPanelOpen then
  1350. -- Open animation
  1351. indexPanel.Visible = true
  1352. indexPanel.Size = UDim2.new(0, 0, 0, 0)
  1353.  
  1354. local tweenInfo = TweenInfo.new(
  1355. 0.3,
  1356. Enum.EasingStyle.Back,
  1357. Enum.EasingDirection.Out
  1358. )
  1359.  
  1360. local tween = TweenService:Create(
  1361. indexPanel,
  1362. tweenInfo,
  1363. {Size = UDim2.new(0, 900, 0, 600)}
  1364. )
  1365. tween:Play()
  1366.  
  1367. else
  1368. -- Close animation
  1369. local tweenInfo = TweenInfo.new(
  1370. 0.2,
  1371. Enum.EasingStyle.Quad,
  1372. Enum.EasingDirection.In
  1373. )
  1374.  
  1375. local tween = TweenService:Create(
  1376. indexPanel,
  1377. tweenInfo,
  1378. {Size = UDim2.new(0, 0, 0, 0)}
  1379. )
  1380. tween:Play()
  1381. tween.Completed:Wait()
  1382. indexPanel.Visible = false
  1383. end
  1384. end
  1385.  
  1386. -- ========================================
  1387. -- UPDATE SNEAKER GRID
  1388. -- ========================================
  1389.  
  1390. local function updateSneakerGrid()
  1391. -- Clear existing sneaker frames
  1392. for _, child in pairs(sneakerGrid:GetChildren()) do
  1393. if child:IsA("Frame") and child.Name ~= "UIGridLayout" then
  1394. child:Destroy()
  1395. end
  1396. end
  1397.  
  1398. -- Get sneakers based on current filter
  1399. local sneakersToShow = {}
  1400. if currentFilter == "All" then
  1401. sneakersToShow = SneakerData.Sneakers
  1402. else
  1403. sneakersToShow = SneakerData:GetSneakersByRarity(currentFilter)
  1404. end
  1405.  
  1406. -- Create UI for each sneaker
  1407. for _, sneaker in pairs(sneakersToShow) do
  1408. local sneakerFrame = sneakerTemplate:Clone()
  1409. sneakerFrame.Name = sneaker.Id
  1410. sneakerFrame.Parent = sneakerGrid
  1411. sneakerFrame.Visible = true
  1412.  
  1413. local isUnlocked = discoveredSneakers[sneaker.Id] == true
  1414.  
  1415. if isUnlocked then
  1416. -- UNLOCKED SNEAKER
  1417. sneakerFrame.SneakerName.Text = sneaker.Name
  1418. sneakerFrame.Rarity.Text = sneaker.Rarity
  1419. sneakerFrame.Value.Text = "๐Ÿ’ฐ "..sneaker.Value
  1420. sneakerFrame.Value.Visible = true
  1421. sneakerFrame.SneakerImage.Image = sneaker.ImageId
  1422. sneakerFrame.SneakerImage.ImageTransparency = 0
  1423. sneakerFrame.LockIcon.Visible = false
  1424.  
  1425. local unlockedBadge = sneakerFrame:FindFirstChild("UnlockedBadge")
  1426. if unlockedBadge then
  1427. unlockedBadge.Visible = true
  1428. end
  1429.  
  1430. -- Set rarity color
  1431. local rarityColor = SneakerData.RarityColors[sneaker.Rarity]
  1432. sneakerFrame.BackgroundColor3 = rarityColor
  1433. sneakerFrame.BorderColor3 = rarityColor
  1434.  
  1435. else
  1436. -- LOCKED SNEAKER
  1437. sneakerFrame.SneakerName.Text = "???"
  1438. sneakerFrame.Rarity.Text = sneaker.Rarity
  1439. sneakerFrame.Value.Visible = false
  1440. sneakerFrame.SneakerImage.ImageTransparency = 0.8
  1441. sneakerFrame.LockIcon.Visible = true
  1442.  
  1443. local unlockedBadge = sneakerFrame:FindFirstChild("UnlockedBadge")
  1444. if unlockedBadge then
  1445. unlockedBadge.Visible = false
  1446. end
  1447.  
  1448. sneakerFrame.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
  1449. sneakerFrame.BorderColor3 = Color3.fromRGB(70, 70, 70)
  1450. end
  1451. end
  1452.  
  1453. -- Update progress text
  1454. local totalSneakers = #SneakerData.Sneakers
  1455. local unlockedCount = 0
  1456. for _ in pairs(discoveredSneakers) do
  1457. unlockedCount = unlockedCount + 1
  1458. end
  1459.  
  1460. progressText.Text = "Discovered: "..unlockedCount.."/"..totalSneakers
  1461. end
  1462.  
  1463. -- ========================================
  1464. -- FILTER BUTTON HANDLERS
  1465. -- ========================================
  1466.  
  1467. local function setupFilterButtons()
  1468. for _, button in pairs(filterFrame:GetChildren()) do
  1469. if button:IsA("TextButton") then
  1470. button.MouseButton1Click:Connect(function()
  1471. -- Update current filter
  1472. currentFilter = button.Name:gsub("Button", "")
  1473.  
  1474. -- Update button visuals
  1475. for _, btn in pairs(filterFrame:GetChildren()) do
  1476. if btn:IsA("TextButton") then
  1477. if btn == button then
  1478. -- Selected button
  1479. btn.BackgroundColor3 = Color3.fromRGB(85, 170, 255)
  1480. btn.TextColor3 = Color3.fromRGB(255, 255, 255)
  1481. else
  1482. -- Unselected button
  1483. btn.BackgroundColor3 = Color3.fromRGB(70, 70, 70)
  1484. btn.TextColor3 = Color3.fromRGB(200, 200, 200)
  1485. end
  1486. end
  1487. end
  1488.  
  1489. -- Update display
  1490. updateSneakerGrid()
  1491. end)
  1492. end
  1493. end
  1494. end
  1495.  
  1496. -- ========================================
  1497. -- RECEIVE SNEAKER DISCOVERIES
  1498. -- ========================================
  1499.  
  1500. sneakerDiscovered.OnClientEvent:Connect(function(data)
  1501. if typeof(data) == "table" then
  1502. -- Full index update
  1503. discoveredSneakers = data
  1504. print("Received full sneaker index")
  1505. else
  1506. -- Single sneaker discovered
  1507. discoveredSneakers[data] = true
  1508. print("Discovered sneaker:", data)
  1509. end
  1510.  
  1511. updateSneakerGrid()
  1512. end)
  1513.  
  1514. -- ========================================
  1515. -- BUTTON CLICK HANDLERS
  1516. -- ========================================
  1517.  
  1518. indexButton.MouseButton1Click:Connect(togglePanel)
  1519.  
  1520. -- Close button
  1521. local closeButton = indexPanel.Header:FindFirstChild("CloseButton")
  1522. if closeButton then
  1523. closeButton.MouseButton1Click:Connect(togglePanel)
  1524. end
  1525.  
  1526. -- ========================================
  1527. -- BUTTON HOVER EFFECTS
  1528. -- ========================================
  1529.  
  1530. indexButton.MouseEnter:Connect(function()
  1531. TweenService:Create(
  1532. indexButton,
  1533. TweenInfo.new(0.2, Enum.EasingStyle.Quad),
  1534. {Size = UDim2.new(0, 70, 0, 70)}
  1535. ):Play()
  1536. end)
  1537.  
  1538. indexButton.MouseLeave:Connect(function()
  1539. TweenService:Create(
  1540. indexButton,
  1541. TweenInfo.new(0.2, Enum.EasingStyle.Quad),
  1542. {Size = UDim2.new(0, 60, 0, 60)}
  1543. ):Play()
  1544. end)
  1545.  
  1546. -- ========================================
  1547. -- INITIALIZATION
  1548. -- ========================================
  1549.  
  1550. -- Start with panel closed
  1551. indexPanel.Visible = false
  1552. indexPanel.Size = UDim2.new(0, 0, 0, 0)
  1553.  
  1554. -- Setup filter buttons
  1555. setupFilterButtons()
  1556.  
  1557. -- Initial display
  1558. updateSneakerGrid()
  1559.  
  1560. print("โœ… Index Client initialized")
  1561.  
  1562. -- Request full index from server
  1563. task.wait(1)
  1564. sneakerDiscovered:FireServer()
  1565.  
  1566. -NOTIFICATIONCLIENT
  1567. --[[
  1568. NOTIFICATION CLIENT (FINAL FIX)
  1569. Location: StarterPlayer/StarterPlayerScripts/NotificationClient
  1570.  
  1571. FIX: Corrected notification positioning to be visible on screen
  1572. --]]
  1573.  
  1574. local Players = game:GetService("Players")
  1575. local ReplicatedStorage = game:GetService("ReplicatedStorage")
  1576. local TweenService = game:GetService("TweenService")
  1577.  
  1578. local player = Players.LocalPlayer
  1579.  
  1580. print("๐Ÿ”” Notification Client starting...")
  1581.  
  1582. -- ========================================
  1583. -- WAIT FOR UI ELEMENTS WITH TIMEOUT
  1584. -- ========================================
  1585.  
  1586. local function WaitForChildSafe(parent, childName, timeout)
  1587. local child = parent:WaitForChild(childName, timeout or 10)
  1588. if not child then
  1589. warn("โŒ Failed to find:", childName, "in", parent:GetFullName())
  1590. end
  1591. return child
  1592. end
  1593.  
  1594. local playerGui = player:WaitForChild("PlayerGui", 10)
  1595. if not playerGui then
  1596. warn("โŒ PlayerGui not found!")
  1597. return
  1598. end
  1599.  
  1600. local notificationUI = WaitForChildSafe(playerGui, "NotificationUI")
  1601. if not notificationUI then
  1602. warn("โŒ NotificationUI not found in PlayerGui!")
  1603. return
  1604. end
  1605.  
  1606. local notificationContainer = WaitForChildSafe(notificationUI, "NotificationContainer")
  1607. if not notificationContainer then
  1608. warn("โŒ NotificationContainer not found!")
  1609. return
  1610. end
  1611.  
  1612. print("โœ… Found NotificationContainer")
  1613.  
  1614. -- Get template from ReplicatedStorage
  1615. local Templates = WaitForChildSafe(ReplicatedStorage, "Templates")
  1616. if not Templates then
  1617. warn("โŒ Templates folder not found!")
  1618. return
  1619. end
  1620.  
  1621. local notificationTemplate = WaitForChildSafe(Templates, "NotificationTemplate")
  1622. if not notificationTemplate then
  1623. warn("โŒ NotificationTemplate not found!")
  1624. return
  1625. end
  1626.  
  1627. print("โœ… Found NotificationTemplate")
  1628.  
  1629. -- ========================================
  1630. -- REMOTE EVENTS
  1631. -- ========================================
  1632.  
  1633. local RemoteEvents = WaitForChildSafe(ReplicatedStorage, "RemoteEvents")
  1634. if not RemoteEvents then
  1635. warn("โŒ RemoteEvents folder not found!")
  1636. return
  1637. end
  1638.  
  1639. local showNotification = WaitForChildSafe(RemoteEvents, "ShowNotification")
  1640. if not showNotification then
  1641. warn("โŒ ShowNotification RemoteEvent not found!")
  1642. return
  1643. end
  1644.  
  1645. print("โœ… Found ShowNotification RemoteEvent")
  1646.  
  1647. -- ========================================
  1648. -- STATE VARIABLES
  1649. -- ========================================
  1650.  
  1651. local activeNotifications = {}
  1652. local MAX_NOTIFICATIONS = 5
  1653.  
  1654. -- ========================================
  1655. -- DISPLAY NOTIFICATION
  1656. -- ========================================
  1657.  
  1658. local function displayNotification(title, message, color)
  1659. print("๐Ÿ“ฉ Displaying notification:", title, "-", message)
  1660.  
  1661. -- Remove oldest notification if we're at max
  1662. if #activeNotifications >= MAX_NOTIFICATIONS then
  1663. local oldest = activeNotifications[1]
  1664. if oldest and oldest.Parent then
  1665. removeNotification(oldest, true)
  1666. end
  1667. end
  1668.  
  1669. -- Create notification frame
  1670. local notif = notificationTemplate:Clone()
  1671. notif.Name = "Notification_" .. tick()
  1672. notif.Parent = notificationContainer
  1673. notif.Visible = true
  1674. notif.BackgroundColor3 = color or Color3.fromRGB(85, 170, 255)
  1675.  
  1676. -- Set content
  1677. local titleLabel = notif:FindFirstChild("Title")
  1678. local messageLabel = notif:FindFirstChild("Message")
  1679.  
  1680. if titleLabel then
  1681. titleLabel.Text = title
  1682. print("โœ“ Set title:", title)
  1683. else
  1684. warn("โš ๏ธ Title label not found in notification template")
  1685. end
  1686.  
  1687. if messageLabel then
  1688. messageLabel.Text = message
  1689. print("โœ“ Set message:", message)
  1690. else
  1691. warn("โš ๏ธ Message label not found in notification template")
  1692. end
  1693.  
  1694. -- Add to active list
  1695. table.insert(activeNotifications, notif)
  1696.  
  1697. -- Calculate Y offset for stacking
  1698. local yOffset = (#activeNotifications - 1) * 80
  1699.  
  1700. -- Start position: OFF SCREEN to the right
  1701. notif.Position = UDim2.new(1, 20, 0, yOffset + 10)
  1702. print("๐Ÿ“ Starting position:", notif.Position)
  1703.  
  1704. -- Target position: VISIBLE on screen (10 pixels from right edge)
  1705. local targetPosition = UDim2.new(1, -370, 0, yOffset + 10)
  1706. print("๐ŸŽฏ Target position:", targetPosition)
  1707.  
  1708. -- Animate in (slide from right)
  1709. local tweenInfo = TweenInfo.new(
  1710. 0.3,
  1711. Enum.EasingStyle.Back,
  1712. Enum.EasingDirection.Out
  1713. )
  1714.  
  1715. local success, err = pcall(function()
  1716. local tweenIn = TweenService:Create(
  1717. notif,
  1718. tweenInfo,
  1719. {Position = targetPosition}
  1720. )
  1721. tweenIn:Play()
  1722. end)
  1723.  
  1724. if not success then
  1725. warn("โš ๏ธ Error animating notification:", err)
  1726. end
  1727.  
  1728. print("โœ… Notification animated successfully")
  1729.  
  1730. -- Auto-remove after 3 seconds
  1731. task.delay(3, function()
  1732. removeNotification(notif)
  1733. end)
  1734.  
  1735. -- Close button handler
  1736. local closeButton = notif:FindFirstChild("CloseButton")
  1737. if closeButton then
  1738. closeButton.MouseButton1Click:Connect(function()
  1739. print("๐Ÿ—‘๏ธ Close button clicked")
  1740. removeNotification(notif)
  1741. end)
  1742. end
  1743.  
  1744. print("โœ… Notification displayed successfully")
  1745. end
  1746.  
  1747. -- ========================================
  1748. -- REMOVE NOTIFICATION
  1749. -- ========================================
  1750.  
  1751. function removeNotification(notif, instant)
  1752. if not notif or not notif.Parent then return end
  1753.  
  1754. print("๐Ÿ—‘๏ธ Removing notification:", notif.Name)
  1755.  
  1756. if instant then
  1757. -- Instant removal (no animation)
  1758. for i, n in pairs(activeNotifications) do
  1759. if n == notif then
  1760. table.remove(activeNotifications, i)
  1761. break
  1762. end
  1763. end
  1764. notif:Destroy()
  1765. repositionNotifications()
  1766. return
  1767. end
  1768.  
  1769. -- Animate out
  1770. local success, err = pcall(function()
  1771. local tweenInfo = TweenInfo.new(
  1772. 0.3,
  1773. Enum.EasingStyle.Quad,
  1774. Enum.EasingDirection.In
  1775. )
  1776.  
  1777. local tweenOut = TweenService:Create(
  1778. notif,
  1779. tweenInfo,
  1780. {
  1781. Position = UDim2.new(1, 20, notif.Position.Y.Scale, notif.Position.Y.Offset),
  1782. BackgroundTransparency = 1
  1783. }
  1784. )
  1785.  
  1786. -- Also fade text
  1787. for _, child in pairs(notif:GetDescendants()) do
  1788. if child:IsA("TextLabel") or child:IsA("TextButton") then
  1789. TweenService:Create(
  1790. child,
  1791. tweenInfo,
  1792. {TextTransparency = 1}
  1793. ):Play()
  1794. end
  1795. end
  1796.  
  1797. tweenOut:Play()
  1798. tweenOut.Completed:Wait()
  1799. end)
  1800.  
  1801. if not success then
  1802. warn("โš ๏ธ Error animating notification removal:", err)
  1803. end
  1804.  
  1805. -- Remove from list
  1806. for i, n in pairs(activeNotifications) do
  1807. if n == notif then
  1808. table.remove(activeNotifications, i)
  1809. break
  1810. end
  1811. end
  1812.  
  1813. notif:Destroy()
  1814.  
  1815. -- Reposition remaining notifications
  1816. repositionNotifications()
  1817. end
  1818.  
  1819. -- ========================================
  1820. -- REPOSITION ALL NOTIFICATIONS
  1821. -- ========================================
  1822.  
  1823. function repositionNotifications()
  1824. for i, notif in pairs(activeNotifications) do
  1825. local yOffset = (i - 1) * 80
  1826.  
  1827. pcall(function()
  1828. local tweenInfo = TweenInfo.new(
  1829. 0.2,
  1830. Enum.EasingStyle.Quad,
  1831. Enum.EasingDirection.Out
  1832. )
  1833.  
  1834. TweenService:Create(
  1835. notif,
  1836. tweenInfo,
  1837. {Position = UDim2.new(1, -370, 0, yOffset + 10)}
  1838. ):Play()
  1839. end)
  1840. end
  1841. end
  1842.  
  1843. -- ========================================
  1844. -- LISTEN FOR SERVER NOTIFICATIONS
  1845. -- ========================================
  1846.  
  1847. showNotification.OnClientEvent:Connect(function(title, message, color)
  1848. print("๐Ÿ“ฌ Received notification from server:", title)
  1849.  
  1850. local success, err = pcall(function()
  1851. displayNotification(title, message, color)
  1852. end)
  1853.  
  1854. if not success then
  1855. warn("โŒ Error displaying notification:", err)
  1856. end
  1857. end)
  1858.  
  1859. -- ========================================
  1860. -- INITIALIZATION
  1861. -- ========================================
  1862.  
  1863. print("โœ… Notification Client initialized")
  1864. print("๐Ÿ“ Container position:", notificationContainer.Position)
  1865. print("๐Ÿ“ Container size:", notificationContainer.Size)
  1866.  
  1867. -- Test notification on startup (optional - remove after testing)
  1868. task.wait(2)
  1869. print("๐Ÿงช Sending test notification...")
  1870. displayNotification("System Ready โœ…", "Notifications are working!", Color3.fromRGB(85, 255, 127))
  1871.  
  1872. -QUESTCLIENT
  1873. --[[
  1874. QUEST CLIENT (LOCAL SCRIPT)
  1875. Location: StarterPlayer/StarterPlayerScripts/QuestClient
  1876.  
  1877. Purpose:
  1878. - Displays Quest UI to players
  1879. - Handles opening/closing quest panel
  1880. - Updates quest progress displays
  1881. - Sends claim requests to server
  1882. --]]
  1883.  
  1884. local Players = game:GetService("Players")
  1885. local ReplicatedStorage = game:GetService("ReplicatedStorage")
  1886. local TweenService = game:GetService("TweenService")
  1887.  
  1888. local player = Players.LocalPlayer
  1889. local playerGui = player:WaitForChild("PlayerGui")
  1890.  
  1891. -- ========================================
  1892. -- WAIT FOR UI ELEMENTS
  1893. -- ========================================
  1894.  
  1895. local questUI = playerGui:WaitForChild("QuestUI")
  1896. local questButton = questUI:WaitForChild("QuestButton")
  1897. local questPanel = questUI:WaitForChild("QuestPanel")
  1898. local questContainer = questPanel:WaitForChild("QuestContainer")
  1899.  
  1900. -- Get template from ReplicatedStorage
  1901. local Templates = ReplicatedStorage:WaitForChild("Templates")
  1902. local questTemplate = Templates:WaitForChild("QuestTemplate")
  1903.  
  1904. -- ========================================
  1905. -- REMOTE EVENTS
  1906. -- ========================================
  1907.  
  1908. local RemoteEvents = ReplicatedStorage:WaitForChild("RemoteEvents")
  1909. local updateQuestProgress = RemoteEvents:WaitForChild("UpdateQuestProgress")
  1910. local questCompleted = RemoteEvents:WaitForChild("QuestCompleted")
  1911. local claimQuestReward = RemoteEvents:WaitForChild("ClaimQuestReward")
  1912.  
  1913. -- ========================================
  1914. -- STATE VARIABLES
  1915. -- ========================================
  1916.  
  1917. local currentQuests = {}
  1918. local isPanelOpen = false
  1919.  
  1920. -- ========================================
  1921. -- TOGGLE QUEST PANEL
  1922. -- ========================================
  1923.  
  1924. local function togglePanel()
  1925. isPanelOpen = not isPanelOpen
  1926.  
  1927. if isPanelOpen then
  1928. -- Open animation
  1929. questPanel.Visible = true
  1930. questPanel.Size = UDim2.new(0, 0, 0, 0)
  1931.  
  1932. local tweenInfo = TweenInfo.new(
  1933. 0.3,
  1934. Enum.EasingStyle.Back,
  1935. Enum.EasingDirection.Out
  1936. )
  1937.  
  1938. local tween = TweenService:Create(
  1939. questPanel,
  1940. tweenInfo,
  1941. {Size = UDim2.new(0, 600, 0, 500)}
  1942. )
  1943. tween:Play()
  1944.  
  1945. else
  1946. -- Close animation
  1947. local tweenInfo = TweenInfo.new(
  1948. 0.2,
  1949. Enum.EasingStyle.Quad,
  1950. Enum.EasingDirection.In
  1951. )
  1952.  
  1953. local tween = TweenService:Create(
  1954. questPanel,
  1955. tweenInfo,
  1956. {Size = UDim2.new(0, 0, 0, 0)}
  1957. )
  1958. tween:Play()
  1959. tween.Completed:Wait()
  1960. questPanel.Visible = false
  1961. end
  1962. end
  1963.  
  1964. -- ========================================
  1965. -- UPDATE QUEST DISPLAY
  1966. -- ========================================
  1967.  
  1968. local function updateQuestDisplay()
  1969. -- Clear existing quest frames
  1970. for _, child in pairs(questContainer:GetChildren()) do
  1971. if child:IsA("Frame") and child.Name:match("^Quest_") then
  1972. child:Destroy()
  1973. end
  1974. end
  1975.  
  1976. -- Create UI for each quest
  1977. for i, quest in pairs(currentQuests) do
  1978. local questFrame = questTemplate:Clone()
  1979. questFrame.Name = "Quest_"..i
  1980. questFrame.Parent = questContainer
  1981. questFrame.Visible = true
  1982.  
  1983. -- Set quest information
  1984. questFrame.Icon.Text = quest.Icon or "๐Ÿ“‹"
  1985. questFrame.Description.Text = quest.Description
  1986. questFrame.Progress.Text = quest.CurrentCount.."/"..quest.TargetCount
  1987. questFrame.RewardLabel.Text = "๐Ÿ’ฐ +"..quest.Reward
  1988.  
  1989. -- Update progress bar
  1990. local progressPercent = math.clamp(quest.CurrentCount / quest.TargetCount, 0, 1)
  1991. local progressBar = questFrame.ProgressBarBG.ProgressBarFill
  1992.  
  1993. TweenService:Create(
  1994. progressBar,
  1995. TweenInfo.new(0.5, Enum.EasingStyle.Quad),
  1996. {Size = UDim2.new(progressPercent, 0, 1, 0)}
  1997. ):Play()
  1998.  
  1999. -- Handle claim button
  2000. local claimButton = questFrame.ClaimButton
  2001.  
  2002. if quest.Completed then
  2003. -- Quest is complete - allow claiming
  2004. claimButton.BackgroundColor3 = Color3.fromRGB(85, 255, 127)
  2005. claimButton.Text = "Claim Reward"
  2006. claimButton.AutoButtonColor = true
  2007.  
  2008. -- Add completed visual effect
  2009. questFrame.BackgroundColor3 = Color3.fromRGB(40, 70, 40)
  2010. questFrame.BorderSizePixel = 3
  2011. questFrame.BorderColor3 = Color3.fromRGB(85, 255, 127)
  2012.  
  2013. -- Claim button click handler
  2014. claimButton.MouseButton1Click:Connect(function()
  2015. claimButton.Text = "Claiming..."
  2016. claimButton.AutoButtonColor = false
  2017. claimQuestReward:FireServer(quest.Id)
  2018. end)
  2019.  
  2020. else
  2021. -- Quest is in progress
  2022. claimButton.BackgroundColor3 = Color3.fromRGB(100, 100, 100)
  2023. claimButton.Text = "In Progress"
  2024. claimButton.AutoButtonColor = false
  2025. end
  2026. end
  2027. end
  2028.  
  2029. -- ========================================
  2030. -- RECEIVE QUEST UPDATES FROM SERVER
  2031. -- ========================================
  2032.  
  2033. updateQuestProgress.OnClientEvent:Connect(function(quests)
  2034. currentQuests = quests
  2035. updateQuestDisplay()
  2036. print("Quest progress updated")
  2037. end)
  2038.  
  2039. -- ========================================
  2040. -- QUEST COMPLETED NOTIFICATION
  2041. -- ========================================
  2042.  
  2043. questCompleted.OnClientEvent:Connect(function(quest)
  2044. print("Quest completed:", quest.Description)
  2045.  
  2046. -- Update local data
  2047. for i, q in pairs(currentQuests) do
  2048. if q.Id == quest.Id then
  2049. currentQuests[i] = quest
  2050. break
  2051. end
  2052. end
  2053.  
  2054. updateQuestDisplay()
  2055.  
  2056. -- Play completion sound (optional)
  2057. -- Uncomment and add your sound ID
  2058. --[[
  2059. local sound = Instance.new("Sound")
  2060. sound.SoundId = "rbxassetid://YOUR_SOUND_ID"
  2061. sound.Volume = 0.5
  2062. sound.Parent = script
  2063. sound:Play()
  2064. sound.Ended:Connect(function()
  2065. sound:Destroy()
  2066. end)
  2067. --]]
  2068. end)
  2069.  
  2070. -- ========================================
  2071. -- BUTTON CLICK HANDLER
  2072. -- ========================================
  2073.  
  2074. questButton.MouseButton1Click:Connect(togglePanel)
  2075.  
  2076. -- Close button inside panel
  2077. local closeButton = questPanel.Header:FindFirstChild("CloseButton")
  2078. if closeButton then
  2079. closeButton.MouseButton1Click:Connect(togglePanel)
  2080. end
  2081.  
  2082. -- ========================================
  2083. -- BUTTON HOVER EFFECTS
  2084. -- ========================================
  2085.  
  2086. questButton.MouseEnter:Connect(function()
  2087. TweenService:Create(
  2088. questButton,
  2089. TweenInfo.new(0.2, Enum.EasingStyle.Quad),
  2090. {Size = UDim2.new(0, 70, 0, 70)}
  2091. ):Play()
  2092. end)
  2093.  
  2094. questButton.MouseLeave:Connect(function()
  2095. TweenService:Create(
  2096. questButton,
  2097. TweenInfo.new(0.2, Enum.EasingStyle.Quad),
  2098. {Size = UDim2.new(0, 60, 0, 60)}
  2099. ):Play()
  2100. end)
  2101.  
  2102. -- ========================================
  2103. -- INITIALIZATION
  2104. -- ========================================
  2105.  
  2106. print("โœ… Quest Client initialized")
  2107.  
  2108. -- Start with panel closed
  2109. questPanel.Visible = false
  2110. questPanel.Size = UDim2.new(0, 0, 0, 0)
Advertisement
Add Comment
Please, Sign In to add comment