Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Auto Herb Collector + Auto Pill Crafter GUI
- -- Tabs: Herbs | Pills | Info
- -- Tracks Spirit Grass + Ginseng counts
- local player = game.Players.LocalPlayer
- local ReplicatedStorage = game:GetService("ReplicatedStorage")
- local ScreenGui = Instance.new("ScreenGui")
- ScreenGui.Parent = player:WaitForChild("PlayerGui")
- -- Main Frame
- local Frame = Instance.new("Frame", ScreenGui)
- Frame.Size = UDim2.new(0, 260, 0, 220)
- Frame.Position = UDim2.new(0, 100, 0, 100)
- Frame.BackgroundColor3 = Color3.fromRGB(25, 25, 25)
- Frame.BorderSizePixel = 0
- Instance.new("UICorner", Frame).CornerRadius = UDim.new(0, 8)
- -- Title
- local Title = Instance.new("TextLabel", Frame)
- Title.Size = UDim2.new(1, 0, 0, 30)
- Title.BackgroundTransparency = 1
- Title.Text = "🌿 Auto Herb Collector / Auto Pill Crafter"
- Title.Font = Enum.Font.SourceSansBold
- Title.TextSize = 18
- Title.TextColor3 = Color3.fromRGB(200, 200, 200)
- -- Tab Frame
- local TabFrame = Instance.new("Frame", Frame)
- TabFrame.Size = UDim2.new(1, 0, 0, 30)
- TabFrame.Position = UDim2.new(0, 0, 0, 30)
- TabFrame.BackgroundTransparency = 1
- local UIListLayout = Instance.new("UIListLayout", TabFrame)
- UIListLayout.FillDirection = Enum.FillDirection.Horizontal
- UIListLayout.Padding = UDim.new(0, 5)
- UIListLayout.HorizontalAlignment = Enum.HorizontalAlignment.Center
- -- Create Tab Button
- local function createTabButton(text)
- local btn = Instance.new("TextButton")
- btn.Size = UDim2.new(0, 80, 0, 25)
- btn.Text = text
- btn.Font = Enum.Font.SourceSansBold
- btn.TextSize = 16
- btn.BackgroundColor3 = Color3.fromRGB(50, 50, 50)
- btn.TextColor3 = Color3.new(1, 1, 1)
- btn.BorderSizePixel = 0
- Instance.new("UICorner", btn).CornerRadius = UDim.new(0, 6)
- btn.Parent = TabFrame
- return btn
- end
- local HerbTab = createTabButton("Herbs")
- local PillTab = createTabButton("Pills")
- local InfoTab = createTabButton("Info")
- -- Content Frames
- local HerbFrame = Instance.new("Frame", Frame)
- HerbFrame.Size = UDim2.new(1, 0, 1, -65)
- HerbFrame.Position = UDim2.new(0, 0, 0, 65)
- HerbFrame.BackgroundTransparency = 1
- local PillFrame = Instance.new("Frame", Frame)
- PillFrame.Size = UDim2.new(1, 0, 1, -65)
- PillFrame.Position = UDim2.new(0, 0, 0, 65)
- PillFrame.BackgroundTransparency = 1
- PillFrame.Visible = false
- local InfoFrame = Instance.new("Frame", Frame)
- InfoFrame.Size = UDim2.new(1, 0, 1, -65)
- InfoFrame.Position = UDim2.new(0, 0, 0, 65)
- InfoFrame.BackgroundTransparency = 1
- InfoFrame.Visible = false
- -- Create Button
- local function createButton(parent, text, color, y)
- local btn = Instance.new("TextButton", parent)
- btn.Size = UDim2.new(0, 220, 0, 35)
- btn.Position = UDim2.new(0, 20, 0, y)
- btn.Text = text
- btn.Font = Enum.Font.SourceSansBold
- btn.TextSize = 16
- btn.BackgroundColor3 = color
- btn.TextColor3 = Color3.new(1, 1, 1)
- btn.BorderSizePixel = 0
- Instance.new("UICorner", btn).CornerRadius = UDim.new(0, 6)
- return btn
- end
- -- Herb Buttons
- local GrassBtn = createButton(HerbFrame, "Toggle Spirit Grass", Color3.fromRGB(70,130,180), 0)
- local GinsengBtn = createButton(HerbFrame, "Toggle Ginseng2", Color3.fromRGB(180,130,70), 45)
- -- Pill Button
- local CraftBtn = createButton(PillFrame, "Toggle Auto Craft Pills", Color3.fromRGB(128,0,128), 0)
- -- Info Labels
- local GrassLabel = Instance.new("TextLabel", InfoFrame)
- GrassLabel.Size = UDim2.new(0, 220, 0, 25)
- GrassLabel.Position = UDim2.new(0, 20, 0, 10)
- GrassLabel.BackgroundTransparency = 1
- GrassLabel.TextColor3 = Color3.fromRGB(150, 220, 150)
- GrassLabel.Font = Enum.Font.SourceSansBold
- GrassLabel.TextSize = 16
- GrassLabel.Text = "Spirit Grass (100): 0"
- local GinsengLabel = Instance.new("TextLabel", InfoFrame)
- GinsengLabel.Size = UDim2.new(0, 220, 0, 25)
- GinsengLabel.Position = UDim2.new(0, 20, 0, 40)
- GinsengLabel.BackgroundTransparency = 1
- GinsengLabel.TextColor3 = Color3.fromRGB(220, 200, 150)
- GinsengLabel.Font = Enum.Font.SourceSansBold
- GinsengLabel.TextSize = 16
- GinsengLabel.Text = "Ginseng (100): 0"
- -- Close Button
- local CloseBtn = createButton(Frame, "Close GUI", Color3.fromRGB(180,60,60), 180)
- -- Toggles
- getgenv().CollectGrass = false
- getgenv().CollectGinseng = false
- getgenv().AutoCraft = false
- -- Collector Loop
- task.spawn(function()
- while task.wait(0.3) do
- if getgenv().CollectGrass then
- for _, herb in pairs(workspace.Herbs:GetChildren()) do
- if herb.Name == "Spirit Grass" and herb:IsA("Model") then
- local target = herb:FindFirstChild("Spirit Grass")
- if target then
- ReplicatedStorage.Events.CollectHerb:FireServer(target)
- end
- end
- end
- end
- if getgenv().CollectGinseng then
- local ginseng2 = workspace.Herbs:FindFirstChild("Ginseng2")
- if ginseng2 and ginseng2:FindFirstChild("Ginseng") then
- ReplicatedStorage.Events.CollectHerb:FireServer(ginseng2.Ginseng)
- end
- end
- end
- end)
- -- Auto Craft Loop
- task.spawn(function()
- while task.wait(1) do
- if getgenv().AutoCraft then
- local args = {
- "Herb_Ginseng_100",
- "Herb_Ginseng_100",
- "Herb_Spirit Grass_100",
- "Herb_Spirit Grass_100",
- 25
- }
- pcall(function()
- ReplicatedStorage.Events.CraftPill:FireServer(unpack(args))
- end)
- end
- end
- end)
- -- Replica listeners
- local events = ReplicatedStorage:WaitForChild("ReplicaRemoteEvents")
- events.Replica_ReplicaSetValue.OnClientEvent:Connect(function(replica, path, value)
- local fullPath = table.concat(path, "/")
- if fullPath == "Inventory/Herbs/Herb_Ginseng/100" then
- GinsengLabel.Text = "Ginseng (100): " .. value
- elseif fullPath == "Inventory/Herbs/Herb_Spirit Grass/100" then
- GrassLabel.Text = "Spirit Grass (100): " .. value
- end
- end)
- events.Replica_ReplicaSetValues.OnClientEvent:Connect(function(replica, values)
- for path, value in pairs(values) do
- local fullPath = table.concat(path, "/")
- if fullPath == "Inventory/Herbs/Herb_Ginseng/100" then
- GinsengLabel.Text = "Ginseng (100): " .. value
- elseif fullPath == "Inventory/Herbs/Herb_Spirit Grass/100" then
- GrassLabel.Text = "Spirit Grass (100): " .. value
- end
- end
- end)
- -- Button Logic
- GrassBtn.MouseButton1Click:Connect(function()
- getgenv().CollectGrass = not getgenv().CollectGrass
- GrassBtn.Text = getgenv().CollectGrass and "Grass: ON" or "Grass: OFF"
- end)
- GinsengBtn.MouseButton1Click:Connect(function()
- getgenv().CollectGinseng = not getgenv().CollectGinseng
- GinsengBtn.Text = getgenv().CollectGinseng and "Ginseng: ON" or "Ginseng: OFF"
- end)
- CraftBtn.MouseButton1Click:Connect(function()
- getgenv().AutoCraft = not getgenv().AutoCraft
- CraftBtn.Text = getgenv().AutoCraft and "Crafting: ON" or "Crafting: OFF"
- end)
- CloseBtn.MouseButton1Click:Connect(function()
- ScreenGui:Destroy()
- end)
- -- Tab Switching
- HerbTab.MouseButton1Click:Connect(function()
- HerbFrame.Visible = true
- PillFrame.Visible = false
- InfoFrame.Visible = false
- end)
- PillTab.MouseButton1Click:Connect(function()
- HerbFrame.Visible = false
- PillFrame.Visible = true
- InfoFrame.Visible = false
- end)
- InfoTab.MouseButton1Click:Connect(function()
- HerbFrame.Visible = false
- PillFrame.Visible = false
- InfoFrame.Visible = true
- end)
- -- Draggable
- local UserInputService = game:GetService("UserInputService")
- local dragging, dragInput, dragStart, startPos
- Frame.InputBegan:Connect(function(input)
- if input.UserInputType == Enum.UserInputType.MouseButton1 then
- dragging = true
- dragStart = input.Position
- startPos = Frame.Position
- input.Changed:Connect(function()
- if input.UserInputState == Enum.UserInputState.End then
- dragging = false
- end
- end)
- end
- end)
- Frame.InputChanged:Connect(function(input)
- if input.UserInputType == Enum.UserInputType.MouseMovement then
- dragInput = input
- end
- end)
- UserInputService.InputChanged:Connect(function(input)
- if input == dragInput and dragging then
- local delta = input.Position - dragStart
- Frame.Position = UDim2.new(startPos.X.Scale, startPos.X.Offset + delta.X,
- startPos.Y.Scale, startPos.Y.Offset + delta.Y)
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment