Advertisement
Cakey3101

Hoop Manager

Apr 29th, 2025
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.27 KB | Source Code | 0 0
  1. local CollectionService = game:GetService("CollectionService")
  2. local Players = game:GetService("Players")
  3.  
  4. local TaggedHoop = CollectionService:GetTagged("hoop")
  5.  
  6. local function Debounce(Function)
  7.     local IsRunning = false
  8.     return function(Hit)
  9.         if not IsRunning then
  10.             IsRunning = true
  11.             Function(Hit)
  12.             IsRunning = false
  13.         end
  14.     end
  15. end
  16.  
  17. for _, Tagged in pairs(TaggedHoop) do
  18.     Tagged.Touched:Connect(Debounce(function(Hit)
  19.         local Humanoid = Hit.Parent:FindFirstChild("Humanoid")
  20.  
  21.         if Humanoid then
  22.             local Cooldown = Tagged:WaitForChild("Cooldown")
  23.             local XPAmount = Tagged:WaitForChild("XPAmount")
  24.             local FrontLabel = Tagged:WaitForChild("FrontSide"):WaitForChild("TextLabel")
  25.             local BackLabel = Tagged:WaitForChild("BackSide"):WaitForChild("TextLabel")
  26.            
  27.             local Player = Players:GetPlayerFromCharacter(Hit.Parent)
  28.            
  29.             if Player then
  30.                 Player.XP.Value += XPAmount.Value
  31.                
  32.                 local Amount = 0
  33.                
  34.                 while Amount < Cooldown.Value do
  35.                     local TimeLeft = Cooldown.Value - Amount
  36.                     FrontLabel.Text = TimeLeft
  37.                     BackLabel.Text = TimeLeft
  38.                    
  39.                     Amount += 1
  40.                     task.wait(1)
  41.                 end
  42.                
  43.                 Amount = 0
  44.                 BackLabel.Text = `+{XPAmount.Value} XP!`
  45.                 FrontLabel.Text = `+{XPAmount.Value} XP!`
  46.             end
  47.         end
  48.     end))
  49. end
Tags: robloxstudio
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement