--BROUGHT TO YOU BY RobloxScripter.com!--
getgenv().Enabled = true -- // Set this to "false" to disable
local Player = game:GetService("Players").LocalPlayer
local RunService = game:GetService("RunService")
local Menu = Player.PlayerGui.Menu
local Currency = Menu.Currency
local Inv = Currency.Inventory
local Amount = Inv.Amount
local NPCFolder = Workspace.NPCs
local Sells = {} do
for _, Obj in next, Workspace:GetDescendants() do
if Obj.Name == "Sell" and Obj.Parent.Name == "Area" and Obj.Parent:IsA("Folder") then
table.insert(Sells, Obj)
end
end
end
local GetNearestSell = function()
local Distance, Nearest = 9e9 do
for _, Sell in next, Sells do
local CurrentDistance = (Sell.Position - Player.Character.HumanoidRootPart.Position).Magnitude
if CurrentDistance < Distance then
Distance = CurrentDistance
Nearest = Sell
end
end
end
return Nearest
end
while getgenv().Enabled == true and task.wait(0.1) do
local AmountSplit = string.split(Amount.Text, " / ")
local CurrentAmount, TotalAmount = AmountSplit[1], AmountSplit[2]
if tonumber(CurrentAmount) < (tonumber(TotalAmount) - 1) then
for _, NPC in next, NPCFolder:GetChildren() do
if NPC:FindFirstChild("HumanoidRootPart") ~= nil then
local RootPart = NPC.HumanoidRootPart
local Prompt = RootPart:FindFirstChildWhichIsA("ProximityPrompt")
if Prompt ~= nil then
Player.Character.HumanoidRootPart.CFrame = RootPart.CFrame * CFrame.new(0, 0, -2)
fireproximityprompt(Prompt)
end
end
end
else
local NearestSell = GetNearestSell()
firetouchinterest(NearestSell, Player.Character.HumanoidRootPart, 0)
task.wait(0.1)
firetouchinterest(NearestSell, Player.Character.HumanoidRootPart, 1)
end
end