local prefix = "-"
local Players = game:GetService("Players")
local LocalPlayer = [Link]
local StarterGui = game:GetService("StarterGui")
local gunAliases = {
["m9"] = "M9",
["ak-47"] = "AK-47",
["ak"] = "AK-47",
["ak47"] = "AK-47",
["remington"] = "Remington 870",
["rem"] = "Remington 870",
["shotgun"] = "Remington 870",
["m4"] = "M4A1",
["m4a1"] = "M4A1"
}
local allGuns = {"M9", "AK-47", "M4A1", "Remington 870"}
local function Notify(text)
pcall(function()
StarterGui:SetCore("SendNotification", {
Title = "Gun Pickup";
Text = text;
Duration = 2;
})
end)
end
local function hasGun(name)
local backpack = LocalPlayer:WaitForChild("Backpack")
local char = [Link] or [Link]:Wait()
return backpack:FindFirstChild(name) or char:FindFirstChild(name)
end
local function GrabGun(gun)
local pad = workspace[gun]
if not pad then
warn("Pad not found:", gun)
return false
end
local padCFrame = [Link]
[Link](0.125)
[Link] = false
repeat [Link]() until [Link] and
[Link]:FindFirstChild("HumanoidRootPart")
local hrp = [Link]
[Link] = [Link]
[Link](0.125)
[Link] = padCFrame
[Link] = true
return true
end
local function GrabGuns(gunsToGrab)
local obtained = {}
for _, gun in ipairs(gunsToGrab) do
if not hasGun(gun) then
if GrabGun(gun) then
[Link](obtained, gun)
end
[Link](0.35)
end
end
if #obtained == 0 then
Notify("All guns already in inventory!")
elseif #obtained == 1 then
Notify("Obtained " .. obtained[1])
else
Notify("Obtained all guns!")
end
end
local function handleCommand(msg)
local lowerMsg = msg:lower()
if lowerMsg == prefix.."guns" or lowerMsg == prefix.."allguns" then
GrabGuns(allGuns)
return
end
if [Link](lowerMsg, 1, #prefix + 3) == prefix.."gun" then
local parts = lowerMsg:split(" ")
local gunArg = parts[2]
if gunArg and gunAliases[gunArg] then
GrabGuns({gunAliases[gunArg]})
else
print("Unknown gun:", gunArg)
end
end
end
game:GetService("TextChatService").MessageReceived:Connect(function(tbl)
if not [Link] then return end
local player = Players:GetPlayerByUserId([Link])
if not player or player ~= LocalPlayer then return end
handleCommand([Link])
end)
LocalPlayer:GetMouse().KeyDown:Connect(function(key)
if key:lower() == "g" then
GrabGuns(allGuns)
end
end)