grow a garden script

Velibit · June 29, 2025
local Rayfield = loadstring(game:HttpGet('https://[Log in to view URL]'))()

local Window = Rayfield:CreateWindow({
   Name = "Милек's garden",
   Icon = 0, -- Icon in Topbar. Can use Lucide Icons (string) or Roblox Image (number). 0 to use no icon (default).
   LoadingTitle = "Loading...",
   LoadingSubtitle = "by Veli",
   ShowText = "Милек hub", -- for mobile users to unhide rayfield, change if you'd like
   Theme = "Default", -- Check https://[Log in to view URL]

   ToggleUIKeybind = "K", -- The keybind to toggle the UI visibility (string like "K" or Enum.KeyCode)

   DisableRayfieldPrompts = false,
   DisableBuildWarnings = false, -- Prevents Rayfield from warning when the script has a version mismatch with the interface

   ConfigurationSaving = {
      Enabled = true,
      FolderName = nil, -- Create a custom folder for your hub/game
      FileName = "idk man big man things"
   },

   Discord = {
      Enabled = false, -- Prompt the user to join your Discord server if their executor supports it
      Invite = "noinvitelink", -- The Discord invite code, do not include discord.gg/. E.g. discord.gg/ ABCD would be ABCD
      RememberJoins = true -- Set this to false to make them join the discord every time they load it up
   },

   KeySystem = false, -- Set this to true to use our key system
   KeySettings = {
      Title = "Untitled",
      Subtitle = "Key System",
      Note = "No method of obtaining the key is provided", -- Use this to tell the user how to get a key
      FileName = "Key", -- It is recommended to use something unique as other scripts using Rayfield may overwrite your key file
      SaveKey = true, -- The user's key will be saved, but if you change the key, they will be unable to use your script
      GrabKeyFromSite = false, -- If this is true, set Key below to the RAW site you would like Rayfield to get the key from
      Key = {"Hello"} -- List of keys that will be accepted by the system, can be RAW file links (pastebin, github etc) or simple strings ("hello","key22")
   }
})

local AutoTab = Window:CreateTab("Auto", nil) -- Title, Image
local MiscTab = Window:CreateTab("Misc", nil) -- Title, Image

local autofarmEnabled = false
local autofarmConnection = nil

local autofarmEnabled = false
local autofarmSpeed = 1 -- default to Medium
local autofarmThread = nil

-- Speed Dropdown
AutoTab:CreateDropdown({
    Name = "Auto Farm Speed",
    Options = {"Fast", "Medium", "Slow"},
    CurrentOption = "Medium",
    Flag = "AutoFarmSpeed",
    Callback = function(Option)
        if Option == "Fast" then
            autofarmSpeed = 0.2
        elseif Option == "Medium" then
            autofarmSpeed = 1
        elseif Option == "Slow" then
            autofarmSpeed = 2
        end
    end,
})

-- Auto Farm + Auto Collect Toggle
AutoTab:CreateToggle({
    Name = "Enable Auto Farm & Collect",
    CurrentValue = false,
    Flag = "AutoFarmToggle",
    Callback = function(Value)
        autofarmEnabled = Value

        if autofarmEnabled then
            autofarmThread = task.spawn(function()
                while autofarmEnabled do
                    pcall(function()
                        -- Auto farm and collect: fire prompts and detectors
                        for _, v in pairs(workspace:GetDescendants()) do
                            if v:IsA("ProximityPrompt") then
                                fireproximityprompt(v)
                            elseif v:IsA("ClickDetector") and v.Parent then
                                fireclickdetector(v)
                            end
                        end
                    end)
                    task.wait(autofarmSpeed)
                end
            end)
        else
            if autofarmThread then
                task.cancel(autofarmThread)
                autofarmThread = nil
            end
        end
    end,
})

local autoBuyFruitsEnabled = false
local selectedFruits = {}
local autoBuyFruitsThread = nil

-- List all fruits in the game here (you can expand this list)
local allFruits = {
    "Apple",
    "Banana",
    "Orange",
    "Pineapple",
    "Peach",
    "Watermelon",
    "Lemon",
    "Mango",
    "Strawberry",
    "Grapes",
    "Dragonfruit",
    "Cherry"
}

-- Multi-selection dropdown
AutoTab:CreateDropdown({
    Name = "Select Fruits to Auto-Buy",
    Options = allFruits,
    MultiSelection = true,
    CurrentOption = {},
    Flag = "SelectedFruits",
    Callback = function(Options)
        selectedFruits = Options
    end,
})

-- Toggle for enabling/disabling the auto-buyer
AutoTab:CreateToggle({
    Name = "Enable Auto Buy Selected Fruits",
    CurrentValue = false,
    Flag = "AutoBuyFruitsToggle",
    Callback = function(Value)
        autoBuyFruitsEnabled = Value

        if autoBuyFruitsEnabled then
            autoBuyFruitsThread = task.spawn(function()
                while autoBuyFruitsEnabled do
                    pcall(function()
                        for _, fruitModel in pairs(workspace:GetDescendants()) do
                            if fruitModel:IsA("Model") and table.find(selectedFruits, fruitModel.Name) then
                                local click = fruitModel:FindFirstChildOfClass("ClickDetector")
                                if click then
                                    fireclickdetector(click)
                                end
                                
                                -- Optional: If the game uses a RemoteEvent instead, you can uncomment this:
                                -- game.ReplicatedStorage.BuyFruit:FireServer(fruitModel.Name)
                            end
                        end
                    end)
                    task.wait(1.5) -- Wait before checking again
                end
            end)
        else
            if autoBuyFruitsThread then
                task.cancel(autoBuyFruitsThread)
                autoBuyFruitsThread = nil
            end
        end
    end,
})

local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local UIS = game:GetService("UserInputService")
local player = Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()

local isInvisible = false

-- Function to toggle invisibility
local function setInvisibility(state)
	isInvisible = state
	character = player.Character or player.CharacterAdded:Wait()

	for _, part in pairs(character:GetDescendants()) do
		if part:IsA("BasePart") then
			part.Transparency = state and 1 or 0
			part.CanCollide = not state
			if part:FindFirstChild("face") then
				part.face.Transparency = state and 1 or 0
			end
		elseif part:IsA("Decal") then
			part.Transparency = state and 1 or 0
		elseif part:IsA("Accessory") or part:IsA("Hat") then
			if part:FindFirstChild("Handle") then
				part.Handle.Transparency = state and 1 or 0
			end
		elseif part:IsA("BillboardGui") then
			part.Enabled = not state -- Hide name tags
		end
	end
end

-- Rayfield Toggle in the Misc tab
MiscTab:CreateToggle({
	Name = "Invisibility",
	CurrentValue = false,
	Flag = "InvisibilityToggle",
	Callback = function(Value)
		setInvisibility(Value)
	end,
})

-- Optional keyboard shortcut (I key)
UIS.InputBegan:Connect(function(input, typing)
	if typing then return end
	if input.KeyCode == Enum.KeyCode.I then
		isInvisible = not isInvisible
		setInvisibility(isInvisible)
	end
end)

-- Reapply invisibility when the player respawns
player.CharacterAdded:Connect(function(newChar)
	character = newChar
	if isInvisible then
		task.wait(1)
		setInvisibility(true)
	end
end)
Output

Comments

Please sign up or log in to contribute to the discussion.