Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local CollectionService = game:GetService("CollectionService")
- local Players = game:GetService("Players")
- local TaggedHoop = CollectionService:GetTagged("hoop")
- local function Debounce(Function)
- local IsRunning = false
- return function(Hit)
- if not IsRunning then
- IsRunning = true
- Function(Hit)
- IsRunning = false
- end
- end
- end
- for _, Tagged in pairs(TaggedHoop) do
- Tagged.Touched:Connect(Debounce(function(Hit)
- local Humanoid = Hit.Parent:FindFirstChild("Humanoid")
- if Humanoid then
- local Cooldown = Tagged:WaitForChild("Cooldown")
- local XPAmount = Tagged:WaitForChild("XPAmount")
- local FrontLabel = Tagged:WaitForChild("FrontSide"):WaitForChild("TextLabel")
- local BackLabel = Tagged:WaitForChild("BackSide"):WaitForChild("TextLabel")
- local Player = Players:GetPlayerFromCharacter(Hit.Parent)
- if Player then
- Player.XP.Value += XPAmount.Value
- local Amount = 0
- while Amount < Cooldown.Value do
- local TimeLeft = Cooldown.Value - Amount
- FrontLabel.Text = TimeLeft
- BackLabel.Text = TimeLeft
- Amount += 1
- task.wait(1)
- end
- Amount = 0
- BackLabel.Text = `+{XPAmount.Value} XP!`
- FrontLabel.Text = `+{XPAmount.Value} XP!`
- end
- end
- end))
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement