Categories > Exploiting > Scripts >
Help with for loop PLS
Posted
So theres this game called STRONGEST PUNCH SIMULATOR and i made a lil farm for it BUT
it uses a for loop and when i want to stop the farm with an toggle it just doesnt
it stops after all its children(orbs) dissapear
also i added cooldown so that i dont get banned so until i collect all the orbs new ones appear and the farm doesnt stop
PLS HELPP
Replied
We can use getgenv
getgenv is a global variable which can be used as a bool, we can make a loop with a global variable like this.
getgenv().autofarm = false -- change this to true to start the loop
while getgenv().autofarm == true do
-- put your remote here
task.wait()
end
Cancel
Post
Languages - C++, C#,Javascript, HTML, CSS, Lua ,Xaml, Python
https://dsc.gg/hackerpluto
Replied
i tried that already
this is what i use for farm
worldcurrent = game:GetService("Players").LocalPlayer.leaderstats.WORLD.Value for i,v in pairs(game:GetService("Workspace").Map.Stages.Boosts[worldcurrent]:GetChildren()) do for a,b in pairs(v:GetChildren()) do game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame = b.CFrame worldcurrent = game:GetService("Players").LocalPlayer.leaderstats.WORLD.Value
end end end
and this is the autofarm toggle
if (state) then getgenv().AutoFarm = true while true do wait() if getgenv().AutoFarm == true then farming() end end else getgenv().AutoFarm = false end
it doesnt stop until all the orbs are collected
Cancel
Post
Replied
local autofarm = 0 -- substitute the 0 for a 1 so you can activate it
while autofarm == 1 do
-- delete this comment and add your remote
wait(0.1)
end
Cancel
Post
Replied
I dont think u understood what i said,the farm i use is using for i,v to get all the orbs from a folder
and it doesnt stop untill all the orbs are collected
Im already using the getgenv().toggle and what u replied with,look at the message above u to see what i use
Cancel
Post
Replied
this should work yea, let me know
function farming()
worldcurrent = game:GetService("Players").LocalPlayer.leaderstats.WORLD.Value
for i,v in pairs(game:GetService("Workspace").Map.Stages.Boosts[worldcurrent]:GetChildren()) do
for a,b in pairs(v:GetChildren()) do
if not getgenv().AutoFarm then return end -- Exit the loop if AutoFarm is false
game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame = b.CFrame
worldcurrent = game:GetService("Players").LocalPlayer.leaderstats.WORLD.Value
end
end
end
local AutoFarm = false -- Set the initial value of AutoFarm to false
-- Define the toggle function
local function Toggle(state)
AutoFarm = state
end
-- Run the farming loop
while true do
wait()
if AutoFarm then farming() end -- Only run the farm if AutoFarm is true
end
Cancel
Post
https://media.discordapp.net/attachments/979069297374671018/1078367228593971362/VelvetSiggy.png
Replied
@Haruka, OMG TYSM UR A LIVESAVER ILYYYYYYYYYYYYYYYYYYYYYYY
jsut gotta implement it inside my gui and thats it,ty sm bro ily❤❤❤
Cancel
Post
Users viewing this thread:
( Members: 0, Guests: 1, Total: 1 )
Cancel
Post