-- Original code by HELL_WORLD / kaka_228 -- Feel free to improve, but keep the credits! local p = game.Players.LocalPlayer local cam = workspace.CurrentCamera local mouse = p:GetMouse() local rs = game:GetService("RunService") local uis = game:GetService("UserInputService") local bs = 4 local vd = 20 local ww = 500 local seed = math.random(1, 1e6) local db = { hp = 100, m = "mine", sel = "Planks", inv = {Wood=10, Stone=10, Dirt=10, Planks=10, Stick=0, Coal=0, IronOre=0, IronIngot=0, Diamond=0, Chest=0}, pwr = 1, items = {"Planks", "Dirt", "Stone", "Wood", "Chest"} } local w_f = workspace:FindFirstChild("World") or Instance.new("Folder", workspace) w_f.Name = "World" local blocks = {} local parts = {} local cfg = { Grass = {c = Color3.fromRGB(90, 160, 70), hp = 0.6, d = "Dirt"}, Dirt = {c = Color3.fromRGB(120, 85, 55), hp = 0.5, d = "Dirt"}, Stone = {c = Color3.fromRGB(130, 130, 130), hp = 2.5, d = "Stone"}, Wood = {c = Color3.fromRGB(110, 75, 45), hp = 1.2, d = "Wood"}, Planks = {c = Color3.fromRGB(170, 135, 90), hp = 1, d = "Planks"}, Leaves = {c = Color3.fromRGB(60, 190, 70), hp = 0.3, d = "Stick"}, Coal = {c = Color3.fromRGB(30, 30, 30), hp = 3, d = "Coal"}, Iron = {c = Color3.fromRGB(200, 175, 160), hp = 5, d = "IronOre"}, Diamond = {c = Color3.fromRGB(100, 240, 255), hp = 10, d = "Diamond"}, Chest = {c = Color3.fromRGB(140, 100, 50), hp = 1.5, d = "Chest"}, Bedrock = {c = Color3.fromRGB(15, 15, 15), hp = 1e6, d = nil} } local function gen() math.randomseed(seed) for x = -ww/2, ww/2 do local sy = math.floor(math.noise(x * 0.05, seed) * 12) + 60 for y = 0, sy do local cv = math.noise(x * 0.1, y * 0.1, seed) if cv < 0.48 or y >= sy - 1 then local t = "Stone" if y == sy then t = "Grass" elseif y > sy - 4 then t = "Dirt" elseif y == 0 then t = "Bedrock" else local r = math.random(1, 1000) if r < 10 then local dp = sy - y if dp > 45 and r < 3 then t = "Diamond" elseif dp > 20 and r < 6 then t = "Iron" else t = "Coal" end end end blocks[x.."_"..y] = t end end if math.random(1, 12) == 1 then local h = math.random(4, 6) for i = 1, h do blocks[x.."_"..(sy+i)] = "Wood" end for lx = -1, 1 do for ly = 1, 2 do blocks[(x+lx).."_"..(sy+h+ly)] = "Leaves" end end end end end local gui = Instance.new("ScreenGui", game.CoreGui) local hud = Instance.new("Frame", gui) hud.Size = UDim2.new(0, 320, 0, 40) hud.Position = UDim2.new(0.5, -160, 0, 10) hud.BackgroundTransparency = 0.5 hud.BackgroundColor3 = Color3.new(0,0,0) local function btn(txt, pos, pnt) local b = Instance.new("TextButton", pnt) b.Size = UDim2.new(0, 80, 1, 0) b.Position = pos b.Text = txt b.BackgroundColor3 = Color3.new(0.2, 0.2, 0.2) b.TextColor3 = Color3.new(1,1,1) b.BorderSizePixel = 0 return b end local m_btn = btn("MINE", UDim2.new(0,0,0,0), hud) local s_btn = btn("BLOCK: "..db.sel, UDim2.new(0,90,0,0), hud) local c_btn = btn("CRAFT", UDim2.new(0,180,0,0), hud) local main = Instance.new("Frame", gui) main.Size = UDim2.new(0, 260, 0, 300) main.Position = UDim2.new(0.5, -130, 0.5, -150) main.Visible = false main.BackgroundColor3 = Color3.new(0.1, 0.1, 0.1) local scroll = Instance.new("ScrollingFrame", main) scroll.Size = UDim2.new(1, -10, 1, -10) scroll.Position = UDim2.new(0, 5, 0, 5) scroll.BackgroundTransparency = 1 Instance.new("UIListLayout", scroll).Padding = UDim.new(0, 5) local recipes = { {n="Planks (1 Wood)", r={Wood=1}, g={Planks=4}}, {n="Sticks (2 Planks)", r={Planks=2}, g={Stick=4}}, {n="Stone Pick (3 Stone)", r={Stick=2, Stone=3}, p=3}, {n="Iron Pick (3 Iron)", r={Stick=2, IronIngot=3}, p=7} } local function refresh() for _, v in pairs(scroll:GetChildren()) do if v:IsA("TextButton") then v:Destroy() end end for _, r in pairs(recipes) do local b = Instance.new("TextButton", scroll) b.Size = UDim2.new(1, 0, 0, 35) b.Text = r.n b.MouseButton1Click:Connect(function() local ok = true for k, v in pairs(r.r) do if (db.inv[k] or 0) < v then ok = false end end if ok then for k, v in pairs(r.r) do db.inv[k] -= v end if r.g then for k, v in pairs(r.g) do db.inv[k] = (db.inv[k] or 0) + v end end if r.p then db.pwr = r.p end refresh() end end) end end m_btn.MouseButton1Click:Connect(function() db.m = (db.m == "mine") and "build" or "mine" m_btn.Text = db.m:upper() m_btn.BackgroundColor3 = (db.m == "mine") and Color3.new(0.2,0.2,0.2) or Color3.new(0,0.4,0) end) s_btn.MouseButton1Click:Connect(function() local i = table.find(db.items, db.sel) or 1 db.sel = db.items[i % #db.items + 1] s_btn.Text = "BLOCK: "..db.sel end) c_btn.MouseButton1Click:Connect(function() main.Visible = not main.Visible refresh() end) local curB, mt = nil, 0 uis.InputBegan:Connect(function(i, g) if g then return end if i.UserInputType == Enum.UserInputType.MouseButton1 or i.UserInputType == Enum.UserInputType.Touch then if not mouse.Target then return end if db.m == "mine" then if mouse.Target.Parent == w_f then curB = mouse.Target; mt = 0 end else if (db.inv[db.sel] or 0) > 0 then local pz = mouse.Target.Position + (Vector3.FromNormalId(mouse.TargetSurface) * bs) local id = math.round(pz.X/bs).."_"..math.round(pz.Y/bs) if not blocks[id] then blocks[id] = db.sel db.inv[db.sel] -= 1 end end end end end) uis.InputEnded:Connect(function(i) if i.UserInputType == Enum.UserInputType.MouseButton1 then if curB then curB.Transparency = 0 end curB = nil end end) rs.RenderStepped:Connect(function(dt) local char = p.Character if not char or not char:FindFirstChild("HumanoidRootPart") then return end local hrp = char.HumanoidRootPart if hrp.Position.Y < -60 then hrp.CFrame = CFrame.new(0, 250, 0) end if curB and curB.Parent and db.m == "mine" then mt += dt local h = (cfg[curB.Name].hp or 1) / db.pwr curB.Transparency = math.clamp(mt/h, 0, 0.7) if mt >= h then local id = math.round(curB.Position.X/bs).."_"..math.round(curB.Position.Y/bs) if cfg[curB.Name].d then db.inv[cfg[curB.Name].d] = (db.inv[cfg[curB.Name].d] or 0) + 1 end blocks[id] = nil curB:Destroy() curB = nil end end local cx, cy = math.round(hrp.Position.X/bs), math.round(hrp.Position.Y/bs) for x = cx - vd, cx + vd do for y = cy - vd, cy + vd do local id = x.."_"..y if blocks[id] and not parts[id] then local b = Instance.new("Part") b.Size = Vector3.new(bs, bs, bs) b.Position = Vector3.new(x*bs, y*bs, 0) b.Anchored = true b.Name = blocks[id] b.Color = cfg[blocks[id]].c b.Material = (blocks[id] == "Grass" or blocks[id] == "Leaves") and Enum.Material.Grass or Enum.Material.Slate b.Parent = w_f parts[id] = b end end end for id, obj in pairs(parts) do local px, py = id:match("([%-?%d]+)_([%-?%d]+)") if math.abs(tonumber(px) - cx) > vd + 2 or math.abs(tonumber(py) - cy) > vd + 2 then obj:Destroy() parts[id] = nil end end cam.CameraType = Enum.CameraType.Scriptable cam.CFrame = cam.CFrame:Lerp(CFrame.new(hrp.Position.X, hrp.Position.Y + 5, 32), 0.15) hrp.CFrame = CFrame.new(hrp.Position.X, hrp.Position.Y, 0) * CFrame.Angles(0, math.rad(90), 0) end) gen() local function spawnP() local c = p.Character or p.CharacterAdded:Wait() local r = c:WaitForChild("HumanoidRootPart") r.CFrame = CFrame.new(0, 250, 0) end spawnP() p.CharacterAdded:Connect(spawnP)