Run it
Copy the script and paste it into your executor.
Players = :()
UserInputService = :()
RunService = :()
TweenService = :()
player = Players.LocalPlayer
old = ().LemonTreeScript
old
old.Running =
old.AutoCollecting =
old.InputConnection
old.InputConnection:()
old.DescendantConnection
old.DescendantConnection:()
old.DescendantRemovingConnection
old.DescendantRemovingConnection:()
old.FlightConnection
old.FlightConnection:()
old.RescanConnection
old.RescanConnection:()
old.CameraTween
old.CameraTween:()
old.FlightForce
old.FlightForce:()
old.FlightAttachment
old.FlightAttachment:()
().LemonTreeScript = {
Running = ,
AutoCollecting = ,
InputConnection = ,
DescendantConnection = ,
DescendantRemovingConnection = ,
FlightConnection = ,
RescanConnection = ,
FlightForce = ,
FlightAttachment = ,
CameraTween =
}
ScriptState
ScriptState = ().LemonTreeScript
ScriptState = {
Running = ,
AutoCollecting =
}
FIXED_Y =
TELEPORT_OFFSET =
CAMERA_TWEEN_TIME =
FLIGHT_FORCE_MULTIPLIER =
FRUIT_DELAY =
SEARCH_DELAY =
FRUIT_REACTION_TIME =
CLICK_DELAY =
VISIBILITY_ATTEMPTS =
RESCAN_INTERVAL =
ZONE_MIN_X = -
ZONE_MAX_X =
ZONE_MIN_Z = -
ZONE_MAX_Z =
ZONE_MARGIN =
TELEPORT_MIN_X =
ZONE_MIN_X + ZONE_MARGIN
TELEPORT_MAX_X =
ZONE_MAX_X - ZONE_MARGIN
TELEPORT_MIN_Z =
ZONE_MIN_Z + ZONE_MARGIN
TELEPORT_MAX_Z =
ZONE_MAX_Z - ZONE_MARGIN
trees = {}
fruitCache = {}
fruitStates = {}
previousFruitPresence = {}
lastRescan =
VirtualInputManager
(()
VirtualInputManager =
:()
)
()
ScriptState.Running ==
(clickPart)
clickPart
fruit = clickPart.Parent
fruit
fruit.Name ~=
fruit:()
fruit
(object)
object
object.Name ~=
object:()
fruit = object.Parent
fruit
fruit.Name ~=
fruit:()
detector =
object:()
detector
(tree)
()
tree
tree.Name ~=
tree:()
.(trees, tree)
trees[#trees + ] = tree
(object)
()
(object)
fruit = object.Parent
fruit
lemonTree =
fruit:()
lemonTree
lemonTree:()
lemonTree:()
fruitCache[object] =
(object)
object
fruitCache[object] =
(container)
()
container
container.Name ==
container:()
(container)
_, object (
container:()
)
()
(object)
(object)
_, child (
container:()
)
()
child.Name ==
child:()
(child)
child:()
child:()
(child)
()
()
newTrees = {}
newTreeSet = {}
i = ,
()
tycoon =
:(
.. i
)
tycoon
_, object (
tycoon:()
)
object.Name ==
object:()
newTreeSet[object]
newTreeSet[object] =
newTrees[#newTrees + ] =
object
directTree =
:(
)
directTree
directTree:()
newTreeSet[directTree]
newTreeSet[directTree] =
newTrees[#newTrees + ] =
directTree
trees = newTrees
()
()
oldPresence =
previousFruitPresence
newCache = {}
newPresence = {}
_, tree (trees)
tree
tree.Parent
tree:()
_, object (
tree:()
)
()
(object)
newCache[object] =
newPresence[object] =
oldPresence[object]
fruitStates[object] =
fruit (fruitStates)
newPresence[fruit]
fruitStates[fruit] =
fruitCache = newCache
previousFruitPresence = newPresence
()
()
()
()
lastRescan = .()
()
ScriptState.DescendantConnection =
.DescendantAdded:(
(object)
()
object.Name ==
object:()
(object)
_, child (
object:()
)
(child)
(child)
(object)
(object)
)
ScriptState.DescendantRemovingConnection =
.DescendantRemoving:(
(object)
(object)
)
ScriptState.RescanConnection =
RunService.Heartbeat:(
()
()
ScriptState.AutoCollecting
.() - lastRescan
>= RESCAN_INTERVAL
()
)
(clickPart)
clickPart
clickPart.Parent
clickPart:()
detector =
clickPart:(
)
detector
fruit =
(clickPart)
fruit
fruit:()
(clickPart)
(clickPart)
fruit =
(clickPart)
fruit
fruit.Transparency >=
fruit.Size.Magnitude <
(position)
position.X >= TELEPORT_MIN_X
position.X <= TELEPORT_MAX_X
position.Z >= TELEPORT_MIN_Z
position.Z <= TELEPORT_MAX_Z
(
fruit,
angle
)
radians =
.(angle)
direction =
.(
.(radians),
,
.(radians)
)
position =
fruit.Position
+ direction * TELEPORT_OFFSET
.(
position.X,
FIXED_Y,
position.Z
)
(fruit)
(fruit)
attempt = ,
VISIBILITY_ATTEMPTS -
angle =
attempt
* (
/ VISIBILITY_ATTEMPTS
)
candidate =
(
fruit,
angle
)
(candidate)
(fruit)
state =
fruitStates[fruit]
state
state.Position
distance =
(
fruit.Position
- state.Position
).Magnitude
distance >
fruitStates[fruit] =
state
(fruit)
fruit
fruitStates[fruit] = {
Skipped = ,
Position = fruit.Position
}
(fruit)
(fruit)
state =
(fruit)
state
state.Skipped
(fruit)
(fruit)
(fruit)
(fruit)
()
()
character =
player.Character
character
root =
character:(
)
root
nearest =
nearestDistance = .huge
fruit (fruitCache)
(fruit)
fruitCache[fruit] =
(fruit)
visualFruit =
(fruit)
visualFruit
distance =
(
root.Position
- visualFruit.Position
).Magnitude
distance <
nearestDistance
nearestDistance =
distance
nearest =
fruit
nearest
(fruit)
(fruit)
character =
player.Character
character
root =
character:(
)
root
offset =
root.Position
- fruit.Position
horizontal =
.(
offset.X,
,
offset.Z
)
startAngle =
horizontal.Magnitude >
startAngle =
.(
.(
horizontal.Z,
horizontal.X
)
)
attempt = ,
VISIBILITY_ATTEMPTS -
angle =
startAngle
+ (
attempt
* (
/ VISIBILITY_ATTEMPTS
)
)
candidate =
(
fruit,
angle
)
(candidate)
candidate
(fruit)
()
(fruit)
targetPosition =
(fruit)
targetPosition
(fruit)
character =
player.Character
character
root =
character:(
)
root
root.CFrame =
.(
targetPosition
)
RunService.Heartbeat:()
(fruit)
(fruit)
(fruit)
()
(fruit)
camera =
.CurrentCamera
camera
visualFruit =
(fruit)
visualFruit
ScriptState.CameraTween
ScriptState.CameraTween:()
ScriptState.CameraTween =
cameraPosition =
camera.CFrame.Position
direction =
visualFruit.Position
- cameraPosition
direction.Magnitude <
direction =
direction.Unit
targetCFrame =
.(
cameraPosition,
cameraPosition
+ direction,
.yAxis
)
tween =
TweenService:(
camera,
TweenInfo.(
CAMERA_TWEEN_TIME,
.EasingStyle.Linear,
.EasingDirection.Out
),
{
= targetCFrame
}
)
ScriptState.CameraTween =
tween
tween.Completed:(
()
ScriptState.CameraTween ==
tween
(fruit)
currentCamera =
.CurrentCamera
currentFruit =
(fruit)
currentCamera
currentFruit
position =
currentCamera.CFrame.Position
finalDirection =
currentFruit.Position
- position
finalDirection.Magnitude
>
currentCamera.CFrame =
.(
position,
position
+ finalDirection.Unit,
.yAxis
)
ScriptState.CameraTween =
)
tween:()
(fruit)
(fruit)
camera =
.CurrentCamera
camera
visualFruit =
(fruit)
visualFruit
params =
RaycastParams.()
params.FilterType =
.RaycastFilterType.Exclude
params.IgnoreWater =
filter = {}
player.Character
filter[#filter + ] =
player.Character
params.FilterDescendantsInstances =
filter
origin =
camera.CFrame.Position
direction =
visualFruit.Position
- origin
direction.Magnitude <
result =
:(
origin,
direction,
params
)
result
result.Instance ==
visualFruit
result.Instance ==
fruit
(fruit)
()
(fruit)
camera =
.CurrentCamera
camera
visualFruit =
(fruit)
visualFruit
screenPosition,
onScreen =
camera:(
visualFruit.Position
)
onScreen
x =
.(
screenPosition.X
)
y =
.(
screenPosition.Y
)
x <
y <
x > camera.ViewportSize.X
y > camera.ViewportSize.Y
VirtualInputManager
moveOk =
(
()
VirtualInputManager:
(
x,
y,
)
)
moveOk
.(CLICK_DELAY)
downOk =
(
()
VirtualInputManager:
(
x,
y,
,
,
,
)
)
downOk
.(CLICK_DELAY)
upOk =
(
()
VirtualInputManager:
(
x,
y,
,
,
,
)
)
upOk
mouse1click
ok =
(
()
()
)
ok
(fruit)
startTime =
.()
initialPosition =
fruit.Position
()
ScriptState.AutoCollecting
.() - startTime
< FRUIT_REACTION_TIME
(fruit)
(fruit)
(
fruit.Position
- initialPosition
).Magnitude >
RunService.Heartbeat:()
(fruit)
()
ScriptState.AutoCollecting
(fruit)
state =
(fruit)
state
state.Skipped
fruitStates[fruit] = {
Skipped = ,
Position = fruit.Position
}
(fruit)
RunService.RenderStepped:()
(fruit)
.(
CAMERA_TWEEN_TIME
)
(fruit)
.(FRUIT_DELAY)
(fruit)
(fruit)
()
()
character =
player.Character
character
root =
character:(
)
root
ScriptState.FlightForce
ScriptState.FlightForce:()
ScriptState.FlightForce =
ScriptState.FlightAttachment
ScriptState.FlightAttachment:()
ScriptState.FlightAttachment =
attachment =
.(
)
attachment.Name =
attachment.Parent =
root
ScriptState.FlightAttachment =
attachment
force =
.(
)
force.Name =
force.Attachment0 =
attachment
force.RelativeTo =
.ActuatorRelativeTo.World
force.ApplyAtCenterOfMass =
force.Force =
.(
,
root.AssemblyMass
* .Gravity
* FLIGHT_FORCE_MULTIPLIER,
)
force.Parent =
root
ScriptState.FlightForce =
force
()
ScriptState.FlightForce
ScriptState.FlightForce:()
ScriptState.FlightForce =
ScriptState.FlightAttachment
ScriptState.FlightAttachment:()
ScriptState.FlightAttachment =
ScriptState.FlightConnection =
RunService.Heartbeat:(
()
()
character =
player.Character
character
root =
character:(
)
root
ScriptState.FlightForce
ScriptState.FlightForce.Force =
.(
,
root.AssemblyMass
* .Gravity
* FLIGHT_FORCE_MULTIPLIER,
)
)
()
()
()
ScriptState.AutoCollecting
ok =
(
()
.() - lastRescan
>= RESCAN_INTERVAL
()
fruit =
()
fruit
()
fruit =
()
fruit
(fruit)
)
.(SEARCH_DELAY)
ScriptState.InputConnection =
UserInputService.InputBegan:(
(
input,
gameProcessed
)
()
gameProcessed
input.KeyCode
~= .KeyCode.Y
ScriptState.AutoCollecting
ScriptState.AutoCollecting =
ScriptState.CameraTween
ScriptState.CameraTween:()
ScriptState.CameraTween =
()
ScriptState.AutoCollecting =
lastRescan =
.(
autoCollectLoop
)
)
player.CharacterAdded:(
()
()
fruitStates = {}
previousFruitPresence = {}
.()
()
ScriptState.AutoCollecting
()
)auto lemon collect