Archives
Trending
Support
Login
clear text
XML
Django
JavaScript
MATLAB
C
C++
C#
Python
SQL
Shell
Bash
Markdown
YAML
JSON
HTML
CSS
PHP
Java
Ruby
Go
Rust
Swift
Kotlin
Arduino
TypeScript
Perl
Autohotkey
Lua
SQF
R
Scala
Haskell
Groovy
Dart
Clojure
VB.NET
Objective-C
PowerShell
Bash
CoffeeScript
Verilog
local ReplicatedStorage = game:GetService("ReplicatedStorage") local ServerStorage = game:GetService("ServerStorage") local Http = game:GetService("HttpService") local remoteEvent = ReplicatedStorage:WaitForChild("ToolClaimEvent") local lootsFolder = ServerStorage:WaitForChild("Loots") local Drawers = workspace.Drawers local hasLoot = {} local usedLootDrawers = {} local function handleLootItems(part) local claimedOnes = {} local toolGUID = Http:GenerateGUID() local detect = Instance.new("ClickDetector") detect.MaxActivationDistance = 32 detect.Parent = part detect.MouseClick:Connect(function(player: Player) local tool = game:GetService("ServerStorage"):WaitForChild("Items"):FindFirstChild(part.Name) -- Checks if theres a tool with the same name as the clicking part if not tool then return end local playerBackpack = player:WaitForChild("Backpack") if not claimedOnes[player.UserId] then claimedOnes[player.UserId] = {} end if not claimedOnes[player.UserId][toolGUID] then tool:Clone().Parent = playerBackpack remoteEvent:FireClient(player,part) claimedOnes[player.UserId][toolGUID] = true end end) end local function spawnLoots(lootTools) for i, cloned in lootTools:GetChildren() do cloned = cloned:Clone() local randomLootDrawer = Drawers:GetChildren()[math.random(#Drawers:GetChildren())] while usedLootDrawers[randomLootDrawer] do randomLootDrawer = Drawers:GetChildren()[math.random(#Drawers:GetChildren())] end local randomDrawer = randomLootDrawer:GetChildren()[math.random(#randomLootDrawer:GetChildren())] while not randomDrawer:IsA("Model") or hasLoot[randomDrawer] do randomDrawer = randomLootDrawer:GetChildren()[math.random(#randomLootDrawer:GetChildren())] end hasLoot[randomDrawer] = true cloned:PivotTo(randomDrawer:GetPivot() * CFrame.Angles(0, 0, math.rad(-90))) cloned.Parent = randomDrawer handleLootItems(cloned) end end spawnLoots(lootsFolder:GetChildren()[math.random(#lootsFolder:GetChildren())])
Mark as private (unlisted)
for 30 minutes
for 6 hours
for 1 day
for 1 week
for 1 month
for 1 year
everlasting (like CCCP)