Advertisement
Artani

One Fruit Simulator Script

Dec 3rd, 2022 (edited)
5,019
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 10.83 KB | None | 0 0
  1. local Client = game.Players.LocalPlayer
  2. local ReplicatedStorage = game.ReplicatedStorage
  3. local Mobs = workspace["__GAME"]["__Mobs"]
  4.  
  5. local Bridge = require(ReplicatedStorage.BridgeNet)
  6. local ToolNet = Bridge.CreateBridge("TOOL_EVENT")
  7. local AttackNet = Bridge.CreateBridge("ATTACK_EVENT")
  8. local RemoteNet = Bridge.CreateBridge("REMOTE_EVENT")
  9.  
  10. local Settings = {
  11.     AutoPunch = false,
  12.     AutoAttack = false,
  13.     AutoDefense = false,
  14.     AutoChest = false,
  15.     AutoQuest = false,
  16.     SelectedEnemy = nil,
  17.     SelectedMode = nil,
  18. }
  19.  
  20. local EnemyTable = {} --Create a table called EnemyTable
  21. for _, v in pairs(Mobs:GetChildren()) do --For every child in Mobs
  22.     for _, enemy in pairs(v:GetChildren()) do --For every child in the child
  23.         if enemy:FindFirstChild("NpcConfiguration") then --If the child has a child called NpcConfiguration
  24.             if not table.find(EnemyTable, enemy.NpcConfiguration:GetAttribute("Name")) then --If the table does not already have an entry for the enemy
  25.                 table.insert(EnemyTable, enemy.NpcConfiguration:GetAttribute("Name")) --Add the enemy to the table
  26.             end
  27.         end
  28.     end
  29. end
  30.  
  31. local function RemoveTableDupes(tab)
  32.     local hash = {}
  33.     local res = {}
  34.     for _, v in ipairs(tab) do
  35.         if not hash[v] then
  36.             res[#res + 1] = v
  37.             hash[v] = true
  38.         end
  39.     end
  40.     return res
  41. end
  42.  
  43. local outputtedEnemies = RemoveTableDupes(EnemyTable)
  44.  
  45. --ToolNet:Fire("Combat", 1, false, Client.Character.Combat, "Melee")
  46. --ToolNet:Fire("Defence", Client.Character.Defence, "Defence")
  47. --AttackNet:Fire(getClosestMob(), Client.Character.Combat)
  48.  
  49. local function getClosestMob(name)
  50.     local closest, maxDist = nil, 9e9
  51.     for _, v in pairs(Mobs:GetChildren()) do
  52.         for _, mob in pairs(v:GetChildren()) do
  53.             if mob:FindFirstChild("NpcConfiguration") and mob.NpcConfiguration:GetAttribute("Health") > 0 then
  54.                 if mob.NpcConfiguration:GetAttribute("Name") == name then
  55.                     local dist = (mob.PrimaryPart.Position - Client.Character.PrimaryPart.Position).magnitude
  56.                     if dist < maxDist then
  57.                         maxDist = dist
  58.                         closest = mob
  59.                     end
  60.                 end
  61.             end
  62.         end
  63.     end
  64.     return closest
  65. end
  66.  
  67. --[[
  68. 1. The function takes in a string parameter which is the name of the mob you want to get the closest one of
  69. 2. It then creates two variables, closest and maxDist. The closest variable is the closest mob to the player and maxDist is the maximum distance between the player and the closest mob
  70. 3. It then loops through all of the mobs in the game and checks if they are valid enemies (have a NpcConfiguration and their health is greater than 0)
  71. 4. If the mob is a valid enemy, it checks if the mob's name matches the name parameter
  72. 5. If the mob's name matches the name parameter, it checks if the mob is closer to the player than the previous closest mob. If it is, it sets the closest variable to the mob and the maxDist variable to the distance between the mob and the player
  73. 6. Once the loop is done, it returns the closest mob
  74. ]]
  75.  
  76. local function getWeapon()
  77.     local weapon = Client.Character:FindFirstChildOfClass("Tool")
  78.     if weapon and weapon:GetAttribute("Type") ~= "Defence" then
  79.         return weapon
  80.     end
  81. end
  82.  
  83. local function getFruit()
  84.     local fruit = Client.Character:FindFirstChildOfClass("Tool")
  85.     if fruit and fruit:GetAttribute("Type") == "Fruit" then
  86.         return fruit
  87.     end
  88. end
  89.  
  90. -- check if new mobs are spawned and if they arent in the table, add them
  91. Mobs.ChildAdded:Connect(function(child)
  92.     for _, v in pairs(child:GetChildren()) do
  93.         if v:FindFirstChild("NpcConfiguration") then
  94.             if not table.find(EnemyTable, v.NpcConfiguration:GetAttribute("Name")) then
  95.                 table.insert(EnemyTable, v.NpcConfiguration:GetAttribute("Name"))
  96.             end
  97.         end
  98.     end
  99. end)
  100.  
  101. local Functions = {}
  102. do
  103.     function Functions.AutoPunch()
  104.         while true do
  105.             task.wait()
  106.             if Settings.AutoPunch then
  107.                 pcall(function()
  108.                     local weapon = getWeapon()
  109.                     if weapon then
  110.                         ToolNet:Fire("Combat", 1, false, weapon, weapon:GetAttribute("Type"))
  111.                     end
  112.                 end)
  113.             end
  114.         end
  115.     end
  116.  
  117.     function Functions.AutoFarm()
  118.         while true do
  119.             task.wait()
  120.             if Settings.AutoFarm then
  121.                 pcall(function()
  122.                     local weapon = getWeapon()
  123.                     local enemy = getClosestMob(Settings.SelectedEnemy)
  124.                     if weapon and enemy then
  125.                         Client.Character:PivotTo(enemy.PrimaryPart.CFrame * CFrame.new(0, -10, 20))
  126.                         AttackNet:Fire(enemy, weapon)
  127.                     end
  128.                 end)
  129.             end
  130.         end
  131.     end
  132.  
  133.     function Functions.AutoAttack()
  134.         while true do
  135.             task.wait()
  136.             if Settings.AutoAttack then
  137.                 pcall(function()
  138.                     local weapon = getWeapon()
  139.                     local enemy = getClosestMob(Settings.SelectedEnemy)
  140.                     if weapon and enemy then
  141.                         AttackNet:Fire(enemy, weapon)
  142.                     end
  143.                 end)
  144.             end
  145.         end
  146.     end
  147.  
  148.     function Functions.AutoDefense()
  149.         while true do
  150.             task.wait()
  151.             if Settings.AutoDefense then
  152.                 local weapon = Client.Backpack:FindFirstChild("Defence") or Client.Character:FindFirstChild("Defence")
  153.                 if weapon then
  154.                     ToolNet:Fire("Defence", weapon, "Defence")
  155.                 end
  156.             end
  157.         end
  158.     end
  159.  
  160.     function Functions.AutoChest()
  161.         while true do
  162.             task.wait()
  163.             if Settings.AutoChest then
  164.                 pcall(function()
  165.                     for _, v in pairs(workspace:GetChildren()) do
  166.                         if v:FindFirstChild("ChestInteract") then
  167.                             Client.Character:PivotTo(v.PrimaryPart.CFrame * CFrame.new(0, -10, 0))
  168.                             fireproximityprompt(v.ChestInteract)
  169.                         end
  170.                     end
  171.                 end)
  172.             end
  173.         end
  174.     end
  175.  
  176.     function Functions.AutoQuest()
  177.         while true do
  178.             task.wait()
  179.             if Settings.AutoQuest then
  180.                 pcall(function()
  181.                     local container = Client.PlayerGui.Quests.CurrentQuestContainer
  182.                     container:GetPropertyChangedSignal("Position"):Wait()
  183.                     if container.Position ~= UDim2.new({ { 0.823, 0 }, { 0.362, 0 } }) then
  184.                         RemoteNet:Fire("GetQuest", Client.PlayerGui.Quests:GetAttribute("CurrentQuest"))
  185.                     end
  186.                 end)
  187.             end
  188.         end
  189.     end
  190.  
  191. function Alltools()
  192.     while true do
  193.         task.wait()
  194.         for i,v in pairs(speaker:FindFirstChildOfClass("Backpack"):GetChildren()) do
  195.             if v:IsA("Tool") or v:IsA("HopperBin") then
  196.                 v.Parent = speaker.Character
  197.             end
  198.         end
  199.     end
  200. end
  201. if not game:IsLoaded() then
  202.     game.Loaded:Wait()
  203. end
  204.  
  205. local Rayfield = loadstring(game:HttpGet("https://raw.githubusercontent.com/shlexware/Rayfield/main/source"))()
  206.  
  207.  
  208. local Window = Rayfield:CreateWindow({
  209.     Name = "ArtanisYT | One Fruit Simulator",
  210.     LoadingTitle = "One Fruit Simulator",
  211.     LoadingSubtitle = "YT: Artanis made this ui!",
  212.     ConfigurationSaving = {
  213.         Enabled = true,
  214.         FolderName = nil, -- Create a custom folder for your hub/game
  215.         FileName = "script"
  216.  
  217. }   })
  218. local Tab = Window:CreateTab("Main", 4483362458) -- Title, Image
  219. Tab:CreateToggle({
  220.     Name = "Auto Punch",
  221.     CurrentValue = false,
  222.     Callback = function(Value)
  223.         Settings.AutoPunch = Value
  224.     end,
  225. })
  226.  
  227. Tab:CreateToggle({
  228.     Name = "Auto Farm",
  229.     CurrentValue = false,
  230.     Callback = function(Value)
  231.         Settings.AutoFarm = Value
  232.     end,
  233. })
  234.  
  235. Tab:CreateToggle({
  236.     Name = "Auto Attack",
  237.     CurrentValue = false,
  238.     Callback = function(Value)
  239.         Settings.AutoAttack = Value
  240.     end,
  241. })
  242.  
  243. Tab:CreateDropdown({
  244.     Name = "Select Enemy",
  245.     Options = outputtedEnemies,
  246.     CurrentOption = "CLICK ME",
  247.     Callback = function(Option)
  248.         Settings.SelectedEnemy = Option
  249.     end,
  250. })
  251.  
  252. Tab:CreateToggle({
  253.     Name = "Auto Defense",
  254.     CurrentValue = false,
  255.     Callback = function(Value)
  256.         Settings.AutoDefense = Value
  257.     end,
  258. })
  259.  
  260. Tab:CreateToggle({
  261.     Name = "Auto Chest",
  262.     CurrentValue = false,
  263.     Callback = function(Value)
  264.         Settings.AutoChest = Value
  265.     end,
  266. })
  267. local QuestSelected;
  268.  
  269. Tab:CreateDropdown({
  270.     Name = "Select Quest",
  271.     Options = {"1","2","3","4","5","6","7","8"},
  272.     CurrentOption = "None",
  273.     Callback = function(Option)
  274.         QuestSelected = Option
  275.     end,
  276. })
  277.  
  278. Tab:CreateButton({
  279.     Name = "Get Quest",
  280.     Callback = function()
  281.         local args = {[1] = {[1] = {[1] = "\7",[2] = "GetQuest",[3] = QuestSelected}}}game:GetService("ReplicatedStorage").RemoteEvent:FireServer(unpack(args))
  282.     end,
  283. })
  284.  
  285. Tab:CreateLabel("Get the Quest before enabling Auto Quest")
  286.  
  287. Tab:CreateToggle({
  288.     Name = "Auto Quest",
  289.     CurrentValue = false,
  290.     Callback = function(Value)
  291.         Settings.AutoQuest = Value
  292.     end,
  293. })
  294. local Tab = Window:CreateTab("Teleports", 4483362458) -- Title, Image
  295.  
  296. Tab:CreateButton({
  297.     Name = "Starter Island",
  298.     Callback = function()
  299.         Game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame = CFrame.new(3388.55713, 136.208038, 1728.40283, -1, 0, 0, 0, 1, 0, 0, 0, -1)
  300.     end,
  301. })
  302. Tab:CreateButton({
  303.     Name = "Jungle",
  304.     Callback = function()
  305.         Game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame = CFrame.new(1986.62134, 131.401001, 598.679565, 0.578843892, 0, 0.81543839, 0, 1, 0, -0.81543839, 0, 0.578843892)
  306.     end,
  307. })
  308. Tab:CreateButton({
  309.     Name = "Buggy",
  310.     Callback = function()
  311.         Game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame = CFrame.new(3007.479, 141.433548, -587.198181, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  312.     end,
  313. })
  314. Tab:CreateButton({
  315.     Name = "Marine",
  316.     Callback = function()
  317.         Game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame = CFrame.new(4941.4248, 137.19136, 56.7856445, 0, 0, -1, 0, 1, 0, 1, 0, 0)
  318.     end,
  319. })
  320. Tab:CreateButton({
  321.     Name = "GrandCity",
  322.     Callback = function()
  323.         Game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame = CFrame.new(1038.11609, 124.763535, -1008.62189, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  324.     end,
  325. })
  326. Tab:CreateButton({
  327.     Name = "Gacha",
  328.     Callback = function()
  329.         Game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame = CFrame.new(3432.12598, 140.795761, 1771.28772, 0.374604106, 0, 0.92718488, 0, 1, 0, -0.92718488, 0, 0.374604106)
  330.     end,
  331. })
  332. local Tab = Window:CreateTab("Misc", 4483362458) -- Title, Image
  333.  
  334. Tab:CreateButton({
  335.     Name = "Equip All Tools",
  336.     Callback = function()
  337.         for _, tool in ipairs(game:GetService("Players").LocalPlayer.Backpack:GetChildren()) do
  338.             if tool:IsA("Tool") then
  339.                  tool.Parent = game:GetService("Players").LocalPlayer.Character
  340.             end
  341.         end
  342.     end,
  343. })
  344.  
  345. Tab:CreateInput({
  346.     Name = "FPS CAP",
  347.     PlaceholderText = "Input Placeholder",
  348.     RemoveTextAfterFocusLost = false,
  349.     Callback = function(Text)
  350.         setfpscap(Text)
  351.         -- The function that takes place when the input is changed
  352.             -- The variable (Text) is a string for the value in the text box
  353.     end,
  354. })
  355.  
  356. Tab:CreateButton({
  357.     Name = "Remove Effects for suna",
  358.     Callback = function()
  359.         game:GetService("ReplicatedStorage").Game["__Extra"].Vfx.Suna:Destroy()
  360.     end,
  361. })
  362.  
  363. Tab:CreateButton({
  364.     Name = "Remove Effects for Mera",
  365.     Callback = function()
  366.         game:GetService("ReplicatedStorage").Game["__Assets"].SkillAssets["Mera Mera no Mi"]:Destroy()
  367.     end,
  368. })
  369.  
  370. Tab:CreateButton({
  371.     Name = "Remove Effects for Pika",
  372.     Callback = function()
  373.         game:GetService("ReplicatedStorage").Game["__Extra"].Vfx.Light:Destroy()
  374.     end,
  375. })
  376.  
  377. for _, v in pairs(Functions) do
  378.     task.spawn(v)
  379. end
  380. end
  381.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement