-- LocalScript: PedrinhoHub_LocalSpawner.lua -- Colocar em StarterPlayer > StarterPlayerScripts -- Requisitos: ReplicatedStorage > Folder "Items" com Models/Tools (cada fruta deve ser Tool ou conter uma Tool) local Players = game:GetService("Players") local ReplicatedStorage = game:GetService("ReplicatedStorage") local StarterGui = game:GetService("StarterGui") local UserInputService = game:GetService("UserInputService") local player = Players.LocalPlayer local playerGui = player:WaitForChild("PlayerGui", 5) local ITEMS_FOLDER_NAME = "Items" -- pasta em ReplicatedStorage local COOLDOWN = 0.6 local itemsFolder = ReplicatedStorage:FindFirstChild(ITEMS_FOLDER_NAME) -- ===== UI ===== local screenGui = Instance.new("ScreenGui") screenGui.Name = "PedrinhoHub_GUI" screenGui.ResetOnSpawn = false screenGui.Parent = playerGui local frame = Instance.new("Frame") frame.Size = UDim2.new(0, 380, 0, 220) frame.Position = UDim2.new(0, 20, 0, 80) frame.BackgroundColor3 = Color3.fromRGB(28, 28, 30) frame.BorderSizePixel = 0 frame.Parent = screenGui frame.Active = true frame.Draggable = true local title = Instance.new("TextLabel", frame) title.Size = UDim2.new(1, -16, 0, 36) title.Position = UDim2.new(0, 8, 0, 6) title.BackgroundTransparency = 1 title.Text = "Pedrinho Hub – Spawner Local" title.Font = Enum.Font.SourceSansBold title.TextSize = 18 title.TextColor3 = Color3.fromRGB(255,255,255) title.TextXAlignment = Enum.TextXAlignment.Left local inputBox = Instance.new("TextBox", frame) inputBox.Size = UDim2.new(1, -20, 0, 34) inputBox.Position = UDim2.new(0, 10, 0, 48) inputBox.PlaceholderText = "Digite o nome da fruta..." inputBox.ClearTextOnFocus = false inputBox.Font = Enum.Font.SourceSans inputBox.TextSize = 16 inputBox.BackgroundColor3 = Color3.fromRGB(38,38,40) inputBox.TextColor3 = Color3.fromRGB(230,230,230) inputBox.BorderSizePixel = 0 local spawnBtn = Instance.new("TextButton", frame) spawnBtn.Size = UDim2.new(0.52, -10, 0, 36) spawnBtn.Position = UDim2.new(0, 10, 0, 92) spawnBtn.Text = "Adicionar ao Inventário" spawnBtn.Font = Enum.Font.SourceSansBold spawnBtn.TextSize = 14 spawnBtn.BackgroundColor3 = Color3.fromRGB(70, 70, 75) spawnBtn.TextColor3 = Color3.fromRGB(255,255,255) spawnBtn.BorderSizePixel = 0 local autoEquipToggle = Instance.new("TextButton", frame) autoEquipToggle.Size = UDim2.new(0.44, -10, 0, 36) autoEquipToggle.Position = UDim2.new(0.52, 0, 0, 92) autoEquipToggle.Text = "Auto-Equip: OFF" autoEquipToggle.Font = Enum.Font.SourceSans autoEquipToggle.TextSize = 14 autoEquipToggle.BackgroundColor3 = Color3.fromRGB(60, 60, 65) autoEquipToggle.TextColor3 = Color3.fromRGB(255,255,255) autoEquipToggle.BorderSizePixel = 0 local toggleBtn = Instance.new("TextButton", frame) toggleBtn.Size = UDim2.new(1, -20, 0, 28) toggleBtn.Position = UDim2.new(0, 10, 0, 136) toggleBtn.Text = "Esconder UI" toggleBtn.Font = Enum.Font.SourceSans toggleBtn.TextSize = 14 toggleBtn.BackgroundColor3 = Color3.fromRGB(48, 48, 50) toggleBtn.TextColor3 = Color3.fromRGB(240,240,240) toggleBtn.BorderSizePixel = 0 local listLabel = Instance.new("TextLabel", frame) listLabel.Size = UDim2.new(1, -20, 0, 18) listLabel.Position = UDim2.new(0, 10, 0, 168) listLabel.BackgroundTransparency = 1 listLabel.Text = "Itens disponíveis (pressione R para atualizar):" listLabel.Font = Enum.Font.SourceSans listLabel.TextSize = 13 listLabel.TextColor3 = Color3.fromRGB(200,200,200) listLabel.TextXAlignment = Enum.TextXAlignment.Left local scroll = Instance.new("ScrollingFrame", frame) scroll.Size = UDim2.new(1, -20, 0, 34) scroll.Position = UDim2.new(0, 10, 0, 186) scroll.BackgroundTransparency = 0.95 scroll.BorderSizePixel = 0 scroll.CanvasSize = UDim2.new(0,0,0,0) scroll.Parent = frame local uiListLayout = Instance.new("UIListLayout", scroll) uiListLayout.SortOrder = Enum.SortOrder.LayoutOrder uiListLayout.Padding = UDim.new(0,4) -- ===== util ===== local lastAction = 0 local autoEquip = false local function notify(text, duration) StarterGui:SetCore("SendNotification", {Title = "Pedrinho Hub", Text = text, Duration = duration or 2}) end -- procura Tool dentro do model (busca descendentes) local function findToolInModel(model) if not model then return nil end if model:IsA("Tool") then return model end local tool = model:FindFirstChildOfClass("Tool") if tool then return tool end for _, v in ipairs(model:GetDescendants()) do if v:IsA("Tool") then return v end end return nil end -- adiciona tool ao Backpack (local) local function addToolToBackpack(tool) if not tool then return false end local clone = tool:Clone() clone.Name = tool.Name .. "_local_" .. tostring(math.random(1000,9999)) clone.Parent = player:WaitForChild("Backpack") return clone end -- função principal: busca item e adiciona ao backpack local function addItemByName(name, doAutoEquip) if tick() - lastAction < COOLDOWN then notify("Aguarde um pouco...", 1) return end lastAction = tick() if not name or name == "" then notify("Digite o nome da fruta.", 2) return end if not itemsFolder then notify("ReplicatedStorage."..ITEMS_FOLDER_NAME.." não encontrado.", 2) return end local model = itemsFolder:FindFirstChild(name) if not model then notify("Item '"..name.."' não encontrado.", 2) return end -- tenta obter uma Tool dentro do modelo (ou o próprio) local toolSource = findToolInModel(model) if not toolSource then notify("O item não é uma Tool nem contém uma Tool. Coloque Tools em "..ITEMS_FOLDER_NAME, 3) return end local addedTool = addToolToBackpack(toolSource) if not addedTool then notify("Falha ao adicionar a Tool.", 2) return end notify("Fruta '"..toolSource.Name.."' adicionada ao inventário.", 2) if doAutoEquip then local char = player.Character if char then local humanoid = char:FindFirstChildOfClass("Humanoid") if humanoid then task.delay(0.05, function() pcall(function() humanoid:EquipTool(addedTool) end) end) end end end end -- popula lista de itens do folder local function populateList() for _, c in ipairs(scroll:GetChildren()) do if c:IsA("TextButton") or c:IsA("TextLabel") then c:Destroy() end end if not itemsFolder then local lbl = Instance.new("TextLabel") lbl.Size = UDim2.new(1,0,0,20) lbl.BackgroundTransparency = 1 lbl.Text = "Pasta "..ITEMS_FOLDER_NAME.." não encontrada" lbl.Font = Enum.Font.SourceSans lbl.TextSize = 14 lbl.TextColor3 = Color3.fromRGB(255,150,150) lbl.Parent = scroll scroll.CanvasSize = UDim2.new(0,0,0, uiListLayout.AbsoluteContentSize.Y + 6) return end local names = {} for _, v in ipairs(itemsFolder:GetChildren()) do table.insert(names, v.Name) end table.sort(names) for _, name in ipairs(names) do local btn = Instance.new("TextButton") btn.Size = UDim2.new(1,0,0,20) btn.BackgroundTransparency = 0.7 btn.Text = name btn.Font = Enum.Font.SourceSans btn.TextSize = 14 btn.TextColor3 = Color3.fromRGB(230,230,230) btn.Parent = scroll btn.MouseButton1Click:Connect(function() inputBox.Text = name end) end task.defer(function() scroll.CanvasSize = UDim2.new(0,0,0, uiListLayout.AbsoluteContentSize.Y + 6) end) end -- ===== conexões UI ===== spawnBtn.MouseButton1Click:Connect(function() local name = tostring(inputBox.Text):match("^%s*(.-)%s*$") addItemByName(name, autoEquip) end) autoEquipToggle.MouseButton1Click:Connect(function() autoEquip = not autoEquip autoEquipToggle.Text = "Auto-Equip: " .. (autoEquip and "ON" or "OFF") end) toggleBtn.MouseButton1Click:Connect(function() frame.Visible = not frame.Visible toggleBtn.Text = frame.Visible and "Esconder UI" or "Mostrar UI" end) UserInputService.InputBegan:Connect(function(input, gpe) if gpe then return end if input.KeyCode == Enum.KeyCode.R then populateList() elseif input.KeyCode == Enum.KeyCode.Escape then frame.Visible = not frame.Visible toggleBtn.Text = frame.Visible and "Esconder UI" or "Mostrar UI" end end) -- popula inicialmente populateList()