-- [[ Rscripts Risk Notice ]] -- This script is not verified by rscripts.net. Deal with caution. -- -- Stay safe: -- • Never log in on unofficial Roblox sites or lookalike domains. -- • Real Roblox links use roblox.com (check the .com ending). -- • Treat fake Roblox login / "claim reward" pages as phishing. -- [[ End Rscripts Risk Notice ]] --// ORE COMMAND SYSTEM --// Put this Script inside ServerScriptService local Players = game:GetService("Players") local PREFIX = "/" local SETTINGS = { AutoSellEnabled = true, AutoFarmEnabled = true, -- Seconds between mining attempts MiningCooldown = 1, -- Maximum distance from the player to automatically mine MiningRadius = 60, -- Inventory capacity InventoryCapacity = 100, } local playerData = {} local function getData(player) if not playerData[player] then playerData[player] = { AutoFarm = false, AutoSell = false, Ores = {}, Coins = 0, TotalMined = 0, } end return playerData[player] end local function notify(player, message) print("[ORE SYSTEM] " .. player.Name .. ": " .. message) -- Optional notification through Roblox's default chat local success, err = pcall(function() local chat = game:GetService("TextChatService") local channel = chat.TextChannels:FindFirstChild("RBXGeneral") if channel then channel:DisplaySystemMessage(message) end end) if not success then warn(err) end end -------------------------------------------------- -- ORE FUNCTIONS -------------------------------------------------- local function getOresFolder() return workspace:FindFirstChild("Ores") end local function getOreValue(ore) return ore:GetAttribute("Value") or 10 end local function getOreName(ore) return ore:GetAttribute("OreName") or ore.Name end local function getNearestOre(player) local character = player.Character if not character then return nil end local root = character:FindFirstChild("HumanoidRootPart") if not root then return nil end local folder = getOresFolder() if not folder then return nil end local nearest = nil local nearestDistance = SETTINGS.MiningRadius for _, ore in ipairs(folder:GetChildren()) do local part if ore:IsA("BasePart") then part = ore elseif ore:IsA("Model") then part = ore.PrimaryPart or ore:FindFirstChildWhichIsA("BasePart") end if part then local distance = (root.Position - part.Position).Magnitude if distance <= nearestDistance then nearest = ore nearestDistance = distance end end end return nearest end local function getInventoryAmount(data) local total = 0 for _, amount in pairs(data.Ores) do total += amount end return total end local function mineOre(player, ore) if not ore or not ore.Parent then return end local data = getData(player) if getInventoryAmount(data) >= SETTINGS.InventoryCapacity then if data.AutoSell then -- Automatically sell when full local total = 0 for oreName, amount in pairs(data.Ores) do local value = 10 total += amount * value data.Ores[oreName] = 0 end data.Coins += total notify(player, "💰 Auto-sold inventory for $" .. total) else notify(player, "🎒 Inventory full!") end return end local oreName = getOreName(ore) local value = getOreValue(ore) data.Ores[oreName] = (data.Ores[oreName] or 0) + 1 data.TotalMined += 1 notify( player, "⛏️ Mined " .. oreName .. " (+$" .. value .. " value)" ) -- Remove ore from the mine ore:Destroy() end -------------------------------------------------- -- SELL ORES -------------------------------------------------- local function sellOres(player, specificOre) local data = getData(player) local totalCoins = 0 local soldAmount = 0 for oreName, amount in pairs(data.Ores) do if amount > 0 then if not specificOre or string.lower(oreName) == string.lower(specificOre) then -- Uses 10 as default value. -- Change this to your own ore-value system. local value = 10 totalCoins += amount * value soldAmount += amount data.Ores[oreName] = 0 end end end data.Coins += totalCoins if soldAmount > 0 then notify( player, "💰 Sold " .. soldAmount .. " ores for $" .. totalCoins ) else notify(player, "❌ You don't have any ores to sell.") end end -------------------------------------------------- -- ORE LIST -------------------------------------------------- local function showOreList(player) local data = getData(player) notify(player, "⛏️ YOUR ORES:") for oreName, amount in pairs(data.Ores) do if amount > 0 then notify( player, "• " .. oreName .. " x" .. amount ) end end end -------------------------------------------------- -- STATS -------------------------------------------------- local function showStats(player) local data = getData(player) local inventory = getInventoryAmount(data) notify(player, "========== MINING STATS ==========") notify(player, "⛏️ Total Mined: " .. data.TotalMined) notify(player, "🎒 Inventory: " .. inventory .. "/" .. SETTINGS.InventoryCapacity) notify(player, "💰 Coins: $" .. data.Coins) notify(player, "🤖 Auto Farm: " .. tostring(data.AutoFarm)) notify(player, "💵 Auto Sell: " .. tostring(data.AutoSell)) notify(player, "==================================") end -------------------------------------------------- -- AUTO FARM -------------------------------------------------- local function startAutoFarm(player) local data = getData(player) if data.AutoFarm then notify(player, "⚠️ Auto Farm is already ON.") return end data.AutoFarm = true notify(player, "🤖 Auto Farm ENABLED.") task.spawn(function() while data.AutoFarm and player.Parent do local ore = getNearestOre(player) if ore then mineOre(player, ore) else task.wait(1) end task.wait(SETTINGS.MiningCooldown) end end) end local function stopAutoFarm(player) local data = getData(player) data.AutoFarm = false notify(player, "🛑 Auto Farm DISABLED.") end -------------------------------------------------- -- AUTO SELL -------------------------------------------------- local function startAutoSell(player) local data = getData(player) data.AutoSell = true notify(player, "💵 Auto Sell ENABLED.") end local function stopAutoSell(player) local data = getData(player) data.AutoSell = false notify(player, "🛑 Auto Sell DISABLED.") end -------------------------------------------------- -- COMMAND HANDLER -------------------------------------------------- local function handleCommand(player, message) if string.sub(message, 1, 1) ~= PREFIX then return end local args = string.split(message, " ") local command = string.lower(args[1]) table.remove(args, 1) -------------------------------------------------- -- SELL ORES -------------------------------------------------- if command == "/sellores" then local specificOre = args[1] if specificOre == "auto" then startAutoSell(player) return end if specificOre == "stop" then stopAutoSell(player) return end sellOres(player, specificOre) -------------------------------------------------- -- AUTO FARM -------------------------------------------------- elseif command == "/autofarm" then if args[1] == "stop" then stopAutoFarm(player) else startAutoFarm(player) end -------------------------------------------------- -- ORE LIST -------------------------------------------------- elseif command == "/orelist" then showOreList(player) -------------------------------------------------- -- STATS -------------------------------------------------- elseif command == "/stats" then showStats(player) -------------------------------------------------- -- INVENTORY -------------------------------------------------- elseif command == "/inventory" then local data = getData(player) local amount = getInventoryAmount(data) notify( player, "🎒 Inventory: " .. amount .. "/" .. SETTINGS.InventoryCapacity ) -------------------------------------------------- -- MINES -------------------------------------------------- elseif command == "/mines" then notify(player, "⛏️ Available mining areas:") notify(player, "• Main Mine") notify(player, "• Crystal Cave") notify(player, "• Lava Mine") notify(player, "• Diamond Cavern") -------------------------------------------------- -- HELP -------------------------------------------------- elseif command == "/orehelp" then notify(player, "========== ORE COMMANDS ==========") notify(player, "/sellores - Sell all ores") notify(player, "/sellores [ore] - Sell specific ore") notify(player, "/sellores auto - Enable auto sell") notify(player, "/sellores stop - Disable auto sell") notify(player, "/autofarm - Enable auto farming") notify(player, "/autofarm stop - Disable auto farming") notify(player, "/orelist - Show your ores") notify(player, "/inventory - Show inventory") notify(player, "/stats - Show mining stats") notify(player, "/mines - Show mining areas") notify(player, "==================================") end end -------------------------------------------------- -- PLAYER CONNECTIONS -------------------------------------------------- Players.PlayerAdded:Connect(function(player) getData(player) player.Chatted:Connect(function(message) handleCommand(player, message) end) end) Players.PlayerRemoving:Connect(function(player) playerData[player] = nil end) print("⛏️ ORE COMMAND SYSTEM LOADED")