Yhehewgq

Grow A Garden Pet Spawner Script

Nov 23rd, 2025 (edited)
470
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 5.02 KB | None | 0 0
  1. -- Grow A Garden Script by JayRBLX Scripts
  2. -- Load Rayfield UI Library
  3. local Rayfield = loadstring(game:HttpGet('https://sirius.menu/rayfield'))()
  4.  
  5. -- Create the main window
  6. local Window = Rayfield:CreateWindow({
  7.    Name = "Grow A Garden - JayRBLX Scripts",
  8.    LoadingTitle = "Rayfield Interface Suite",
  9.    LoadingSubtitle = "by Sirius",
  10.    ConfigurationSaving = {
  11.       Enabled = true,
  12.       FolderName = nil,
  13.       FileName = "GrowAGardenHub"
  14.    },
  15.    Discord = {
  16.       Enabled = false,
  17.       Invite = "noinvitelink",
  18.       RememberJoins = true
  19.    },
  20.    KeySystem = false
  21. })
  22.  
  23. -- Home Tab
  24. local HomeTab = Window:CreateTab("Home", 4483362458)
  25. local HomeSection = HomeTab:CreateSection("Welcome Message")
  26.  
  27. HomeTab:CreateLabel("Welcome to Grow A Garden Script!")
  28. HomeTab:CreateLabel("Spawn your favorite pets visually on the client-side.")
  29. HomeTab:CreateLabel("Others will see your holding animation but no pet model.")
  30. HomeTab:CreateLabel("By JayRBLX Scripts - Enjoy gardening!")
  31.  
  32. -- Spawn Pets Tab
  33. local PetsTab = Window:CreateTab("Spawn Pets")
  34. local PetsSection = PetsTab:CreateSection("Pet Spawner")
  35.  
  36. local SelectedPet = ""
  37.  
  38. local PetInput = PetsTab:CreateInput({
  39.    Name = "Enter Pet Name",
  40.    PlaceholderText = "e.g., Bunny, Dog, Capybara, Red Fox",
  41.    RemoveTextAfterFocusLost = false,
  42.    Callback = function(Text)
  43.       SelectedPet = Text
  44.    end,
  45. })
  46.  
  47. local SpawnButton = PetsTab:CreateButton({
  48.    Name = "Spawn Pet (Client-Side Visual)",
  49.    Callback = function()
  50.       if SelectedPet == "" then
  51.          Rayfield:Notify({
  52.             Title = "Error",
  53.             Content = "Please enter a pet name!",
  54.             Duration = 3,
  55.             Image = 4483362458,
  56.          })
  57.          return
  58.       end
  59.  
  60.       local Players = game:GetService("Players")
  61.       local ReplicatedStorage = game:GetService("ReplicatedStorage")
  62.       local player = Players.LocalPlayer
  63.       local char = player.Character or player.CharacterAdded:Wait()
  64.       local humanoidRoot = char:WaitForChild("HumanoidRootPart")
  65.  
  66.       -- Assume pets are stored in ReplicatedStorage.Pets (common in Roblox pet games)
  67.       local petsFolder = ReplicatedStorage:FindFirstChild("Pets")
  68.       if not petsFolder then
  69.          -- Fallback: Try other common locations like ReplicatedStorage.PetModels
  70.          petsFolder = ReplicatedStorage:FindFirstChild("PetModels") or ReplicatedStorage:FindFirstChild("Animals")
  71.          if not petsFolder then
  72.             Rayfield:Notify({
  73.                Title = "Error",
  74.                Content = "Could not find pets folder in ReplicatedStorage!",
  75.                Duration = 5,
  76.                Image = 4483362458,
  77.             })
  78.             return
  79.          end
  80.       end
  81.  
  82.       local petModel = petsFolder:FindFirstChild(SelectedPet)
  83.       if not petModel or not petModel:IsA("Model") then
  84.          Rayfield:Notify({
  85.             Title = "Error",
  86.             Content = SelectedPet .. " model not found! Check spelling or availability.",
  87.             Duration = 5,
  88.             Image = 4483362458,
  89.          })
  90.          return
  91.       end
  92.  
  93.       -- Clone the pet model locally
  94.       local newPet = petModel:Clone()
  95.       newPet.Parent = workspace
  96.  
  97.       -- Attach to player (weld to HumanoidRootPart for following)
  98.       local petRoot = newPet.PrimaryPart or newPet:FindFirstChild("HumanoidRootPart") or newPet:FindFirstChild("Torso")
  99.       if petRoot then
  100.          local weld = Instance.new("WeldConstraint")
  101.          weld.Part0 = humanoidRoot
  102.          weld.Part1 = petRoot
  103.          weld.Parent = newPet
  104.  
  105.          -- Offset position (e.g., to the side)
  106.          petRoot.CFrame = humanoidRoot.CFrame * CFrame.new(3, 0, 0) * CFrame.Angles(0, math.rad(90), 0)
  107.       else
  108.          -- Fallback: Use BodyPosition to follow player
  109.          local bodyPos = Instance.new("BodyPosition")
  110.          bodyPos.MaxForce = Vector3.new(4000, 4000, 4000)
  111.          bodyPos.Position = humanoidRoot.Position + Vector3.new(3, 0, 0)
  112.          bodyPos.Parent = newPet.PrimaryPart or newPet:FindFirstChildOfClass("Part")
  113.  
  114.          -- Update position loop (client-side)
  115.          spawn(function()
  116.             while newPet.Parent and char.Parent do
  117.                bodyPos.Position = humanoidRoot.Position + humanoidRoot.CFrame.LookVector * 3
  118.                wait(0.1)
  119.             end
  120.          end)
  121.       end
  122.  
  123.       -- Notify success
  124.       Rayfield:Notify({
  125.          Title = "Success",
  126.          Content = SelectedPet .. " spawned visually (client-side only)!",
  127.          Duration = 3,
  128.          Image = 4483362458,
  129.       })
  130.    end,
  131. })
  132.  
  133. local ClearButton = PetsTab:CreateButton({
  134.    Name = "Clear Input",
  135.    Callback = function()
  136.       SelectedPet = ""
  137.       PetInput:Set(" ")
  138.    end,
  139. })
  140.  
  141. PetsTab:CreateLabel("Note: Use exact pet names from the game (e.g., Bunny, Capybara, Red Fox).")
  142. PetsTab:CreateLabel("This is purely visual - no server changes or inventory updates.")
  143.  
  144. -- Optional: Add a list of example pets as labels
  145. PetsTab:CreateLabel("Example Pets: Bunny, Dog, Golden Lab, Cat, Pig, Capybara, Scarlet Macaw, Red Fox, Tiger, Lion")
Advertisement
Add Comment
Please, Sign In to add comment