
Key Required

--Script. Made by OpenSourseComunity
local WindUI = loadstring(game:HttpGet("https://raw.githubusercontent.com/Footagesus/WindUI/main/dist/main.lua"))()
local Window = WindUI:CreateWindow({
Title = "Piggy Bot Control",
Icon = "lucide:bot",
Author = "YourName",
Folder = "PiggyBot",
Size = UDim2.fromOffset(580, 460),
Transparent = true,
Theme = "Dark",
Acrylic = true,
})
local Tab1 = Window:Tab({
Title = "Control",
Icon = "lucide:gamepad-2",
})
-- Variables base del script
local inf, pi = math.huge, math.pi
game.Players.LocalPlayer.PlayerGui:FindFirstChild("GameGUI").ResetOnSpawn = false
local Client = game:GetService("Players").LocalPlayer
local Character = Client.Character or Client.CharacterAdded:Wait()
local Humanoid = Character:WaitForChild("Humanoid")
local HumanoidRootPart = Humanoid.RootPart
local Mouse = Client:GetMouse()
local RunService = game:GetService("RunService")
local UserInputService = game:GetService("UserInputService")
local Controlling = false
local CurrentlyControlledNPC = nil
local OriginalProperties = {}
local DisposableInstances = {}
local OriginalPosition
local CurrentMode = 1
local Connections = {}
local ToggleEnabled = true
local lastChar = Character
function CreateDisposableInstance(className, properties)
properties = properties or {}
local instance = Instance.new(className)
table.insert(DisposableInstances, instance)
for name, value in pairs(properties) do
instance[name] = value
end
return instance
end
local ClientHighligher = CreateDisposableInstance("Highlight", {
FillTransparency = 1,
OutlineColor = Color3.fromRGB(75, 150, 255),
Enabled = false,
Parent = Character
})
local ClientAttachment = CreateDisposableInstance("Attachment", {Parent = HumanoidRootPart})
local DummyAttachment = CreateDisposableInstance("Attachment")
local NPCAttachment = CreateDisposableInstance("Attachment")
local ClientVelocity = CreateDisposableInstance("LinearVelocity", {
Attachment0 = ClientAttachment,
MaxForce = inf,
Enabled = false,
Parent = workspace
})
local ClientAlignOrientation = CreateDisposableInstance("AlignOrientation", {
MaxTorque = inf,
Responsiveness = inf,
Attachment0 = ClientAttachment,
Attachment1 = NPCAttachment,
Enabled = false,
Parent = workspace
})
local NPCAlignPosition = CreateDisposableInstance("AlignPosition", {
ApplyAtCenterOfMass = false,
Attachment0 = NPCAttachment,
Attachment1 = DummyAttachment,
MaxForce = inf,
Responsiveness = inf,
Enabled = false,
Parent = workspace
})
local NPCAlignOrientation = CreateDisposableInstance("AlignOrientation", {
MaxTorque = inf,
Responsiveness = inf,
Attachment0 = NPCAttachment,
Attachment1 = DummyAttachment,
Enabled = false,
Parent = workspace
})
local DummyModel, DummyRootPart
local NPCModel, NPCRootPart, NPCName, NPCHighlighter
local DummyDiedConnection, ClientHealthChangedConnection
function SetOriginalProperty(instance, name, value)
local instanceOriginalProperties = OriginalProperties[instance] or {}
instanceOriginalProperties[name] = value
OriginalProperties[instance] = instanceOriginalProperties
end
function SetCameraSubject(subject)
while task.wait() do
local camera = workspace.CurrentCamera
if camera then
camera.CameraSubject = subject
return
end
end
end
Client.CharacterAdded:Connect(function(newCharacter)
local wasDeath = false
if lastChar then
local oldHumanoid = lastChar:FindFirstChildOfClass("Humanoid")
if oldHumanoid and oldHumanoid.Health <= 0 then
wasDeath = true
end
end
if wasDeath then
Character = newCharacter
Humanoid = newCharacter:WaitForChild("Humanoid")
HumanoidRootPart = Humanoid.RootPart
ClientHighligher.Parent = Character
ClientAttachment.Parent = HumanoidRootPart
Humanoid.Died:Once(function()
StopControlling()
end)
end
lastChar = newCharacter
end)
function StopControlling(restorePosition)
Controlling = false
CurrentlyControlledNPC = nil
if ClientHealthChangedConnection then
ClientHealthChangedConnection:Disconnect()
ClientHealthChangedConnection = nil
end
if DummyDiedConnection then
DummyDiedConnection:Disconnect()
DummyDiedConnection = nil
end
NPCAlignPosition.Enabled = false
NPCAlignOrientation.Enabled = false
ClientVelocity.Enabled = false
ClientAlignOrientation.Enabled = false
if CurrentMode == 2 then
if Character then
SetCameraSubject(Humanoid)
Client.Character = Character
else
for _, Newchar in pairs(workspace:GetDescendants()) do
if Newchar.Name == Client.Name then
Client.Character = Newchar
SetCameraSubject(Newchar:FindFirstChildOfClass("Humanoid"))
HumanoidRootPart = Newchar:FindFirstChild("HumanoidRootPart")
Humanoid = Newchar:FindFirstChildOfClass("Humanoid")
end
end
end
else
SetCameraSubject(Humanoid)
Client.Character = Character
end
DummyAttachment.Parent = nil
NPCAttachment.Parent = nil
if DummyModel then
DummyModel:Destroy()
DummyModel = nil
end
DummyRootPart = nil
if NPCHighlighter then
NPCHighlighter:Destroy()
NPCHighlighter = nil
end
NPCModel = nil
NPCRootPart = nil
NPCName = nil
if Humanoid.Health > 0 then
if restorePosition and OriginalPosition then
HumanoidRootPart.CFrame = OriginalPosition
OriginalPosition = nil
end
for instance, originalProperties in pairs(OriginalProperties) do
for name, value in pairs(originalProperties) do
instance[name] = value
end
OriginalProperties[instance] = nil
end
if game.Players.LocalPlayer.Character:FindFirstChild("Energy") and game.Players.LocalPlayer.Character:FindFirstChild("Energy").Value == 100 then
game.Players.LocalPlayer.Character:FindFirstChild("Energy").Value = 99
game.Players.LocalPlayer.Character:FindFirstChild("Energy").Value = 100
end
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
for _, part in ipairs(character:GetChildren()) do
if part:IsA("BasePart") then
part.CanTouch = true
end
end
ClientHighligher.Enabled = false
Humanoid.PlatformStand = false
end
end
function Control(npcModel)
if Controlling then return end
if CurrentlyControlledNPC == npcModel then return end
local npcHumanoid = npcModel:FindFirstChildOfClass("Humanoid")
local npcRootPart = npcHumanoid and npcHumanoid.RootPart
if npcRootPart and npcHumanoid then
local player = game.Players:GetPlayerFromCharacter(npcModel)
if player then return end
if npcModel == Character then return end
CurrentlyControlledNPC = npcModel
OriginalPosition = HumanoidRootPart.CFrame
ClientHighligher.Enabled = true
SetOriginalProperty(HumanoidRootPart, "CFrame", HumanoidRootPart.CFrame)
Humanoid.PlatformStand = true
local localPlayer = game.Players.LocalPlayer
local localCharacter = localPlayer.Character or localPlayer.CharacterAdded:Wait()
for _, part in ipairs(localCharacter:GetChildren()) do
if part:IsA("BasePart") then
part.CanTouch = false
end
end
task.wait(0.5)
if not Humanoid or Humanoid.Health <= 0
or not HumanoidRootPart or not HumanoidRootPart.Parent
or not npcRootPart or not npcRootPart.Parent then
CurrentlyControlledNPC = nil
pcall(function() Humanoid.PlatformStand = false end)
ClientHighligher.Enabled = false
for _, part in ipairs(Character:GetChildren()) do
if part:IsA("BasePart") then
part.CanTouch = true
end
end
return
end
pcall(function() npcRootPart.BodyPosition:Destroy() end)
pcall(function() npcRootPart.BodyGyro:Destroy() end)
local dummyModel = npcModel:Clone()
local dummyHumanoid = dummyModel:FindFirstChildOfClass("Humanoid")
local dummyRootPart = dummyModel:FindFirstChild(npcRootPart.Name)
if CurrentMode == 1 then
DummyDiedConnection = dummyHumanoid.Died:Once(function()
if Controlling then StopControlling(true) end
end)
else
DummyDiedConnection = dummyHumanoid.Died:Once(function()
if Controlling then Humanoid.Health = 0 end
end)
end
local function updateHealth()
if Controlling then
dummyHumanoid.MaxHealth = inf
dummyHumanoid.Health = inf
Humanoid.Health = inf
end
end
ClientHealthChangedConnection = Humanoid.Changed:Connect(updateHealth)
updateHealth()
for _, descendant in pairs(dummyModel:GetDescendants()) do
if descendant:IsA("Light") or descendant:IsA("Sound") then
descendant:Remove()
else
pcall(function() descendant.Transparency = 0.95 end)
end
end
DummyModel = dummyModel
DummyRootPart = dummyRootPart
dummyModel.Parent = workspace
DummyAttachment.Parent = dummyRootPart
NPCAttachment.Parent = npcRootPart
NPCModel = npcModel
NPCRootPart = npcRootPart
NPCName = npcModel.Name
NPCHighlighter = Instance.new("Highlight")
NPCHighlighter.FillTransparency = 1
NPCHighlighter.OutlineColor = Color3.fromRGB(255, 0, 0)
NPCHighlighter.Parent = npcModel
local DummyHighlighter = Instance.new("Highlight")
DummyHighlighter.FillTransparency = 1
DummyHighlighter.OutlineColor = Color3.fromRGB(128, 0, 128)
DummyHighlighter.Parent = dummyModel
SetCameraSubject(dummyHumanoid)
Client.Character = dummyModel
NPCAlignPosition.Enabled = true
NPCAlignOrientation.Enabled = true
ClientAlignOrientation.Enabled = false
ClientVelocity.Enabled = true
Controlling = true
end
end
task.spawn(function()
while true do
task.wait(0.5)
if not Controlling or not ToggleEnabled or CurrentMode ~= 2 then continue end
local npcModel = NPCModel
local dummyRootPart = DummyRootPart
if not npcModel or not dummyRootPart then continue end
for _, objc in ipairs(npcModel:GetDescendants()) do
if objc:IsA("TouchTransmitter") then
objc:Remove()
end
end
for _, objc in ipairs(npcModel:GetDescendants()) do
if objc:IsA("Script") then
objc:Remove()
end
end
local closestRootPart = nil
local closestDist = math.huge
local mainSpawn = workspace:FindFirstChild("GameFolder")
and workspace.GameFolder:FindFirstChild("MainSpawn")
for _, player in ipairs(game.Players:GetPlayers()) do
if player ~= Client
and player.Character
and not player.Character:FindFirstChild("Enemy")
and not player.Character:FindFirstChild("Traitor") then
local rootPart = player.Character:FindFirstChild("HumanoidRootPart")
if rootPart then
if mainSpawn then
local dist = (rootPart.Position - mainSpawn.Position).Magnitude
if dist >= 20 and dist < closestDist then
closestDist = dist
closestRootPart = rootPart
end
else
closestRootPart = rootPart
break
end
end
end
end
if closestRootPart then
dummyRootPart.CFrame = closestRootPart.CFrame * CFrame.new(0, 2, -9)
end
end
end)
function DestroyEverything()
StopControlling(false)
for _, connection in pairs(Connections) do
pcall(function() connection:Disconnect() end)
end
Connections = {}
for _, instance in pairs(DisposableInstances) do
pcall(function() instance:Destroy() end)
end
DisposableInstances = {}
end
-- Componentes de WindUI
Tab1:Paragraph({
Title = "Información",
Desc = "Haz clic en cualquier NPC (Bot) de Piggy para controlarlo.",
})
local ToggleElement = Tab1:Toggle({
Title = "Activar Bot Control",
Desc = "Habilita o deshabilita el sistema de control al hacer clic.",
Value = true,
Callback = function(state)
if not state and Controlling then
StopControlling(true)
end
ToggleEnabled = state
end
})
local ModeDropdown = Tab1:Dropdown({
Title = "Modo de Control",
Desc = "Selecciona el comportamiento del bot.",
Values = {"Normal", "Killer"},
Default = "Normal",
Callback = function(selected)
CurrentMode = (selected == "Normal") and 1 or 2
end
})
Tab1:Button({
Title = "Forzar Parar Control",
Desc = "Devuelve el control a tu personaje original.",
Callback = function()
StopControlling(true)
end
})
Tab1:Button({
Title = "Destruir Interfaz / Script",
Desc = "Limpia todas las conexiones y objetos creados.",
Callback = function()
DestroyEverything()
Window:Destroy()
end
})
local function OnMouseClick()
if not ToggleEnabled then return end
local target = Mouse.Target
if not target then return end
local model = target
while model and model ~= workspace do
local h = model:FindFirstChildOfClass("Humanoid")
if h and h.RootPart then
task.wait(0)
Control(model)
break
end
model = model.Parent
end
end
Connections = {
UserInputService.InputBegan:Connect(function(input, gameProcessedEvent)
if not gameProcessedEvent
and input.KeyCode == Enum.KeyCode.H
and input.UserInputState == Enum.UserInputState.Begin then
ToggleEnabled = not ToggleEnabled
ToggleElement:Set(ToggleEnabled)
if not ToggleEnabled and Controlling then
StopControlling(true)
end
end
end),
Mouse.Button1Down:Connect(OnMouseClick),
RunService.Heartbeat:Connect(function()
if not (Controlling and ToggleEnabled) then return end
if not NPCRootPart or not NPCRootPart.Parent
or not HumanoidRootPart or not HumanoidRootPart.Parent
or not Humanoid or Humanoid.Health <= 0 then
return
end
if type(sethiddenproperty) == "function" then
pcall(function() sethiddenproperty(Client, "SimulationRadius", inf) end)
elseif type(setsimulationradius) == "function" then
pcall(function() setsimulationradius(inf) end)
end
if NPCRootPart then
local offset = CurrentMode == 1 and 7.2 or 8.4
local npcPosition = NPCRootPart.Position
HumanoidRootPart.CFrame = CFrame.new(
npcPosition.X, npcPosition.Y - offset, npcPosition.Z
) * NPCRootPart.CFrame.Rotation
end
for _, child in pairs(Character:GetChildren()) do
if child:IsA("BasePart") and child.CanCollide then
SetOriginalProperty(child, "CanCollide", true)
child.CanCollide = false
SetOriginalProperty(child, "CanTouch", true)
child.CanTouch = false
end
end
if DummyModel then
for _, child in pairs(DummyModel:GetChildren()) do
if child:IsA("BasePart") and child.CanCollide then
child.CanCollide = false
child.CanTouch = false
end
end
end
if NPCModel then
for _, child in pairs(NPCModel:GetChildren()) do
if child:IsA("BasePart") and child.CanCollide then
SetOriginalProperty(child, "CanCollide", true)
child.CanCollide = false
end
end
end
end),
Humanoid.Died:Once(function() StopControlling(false) end),
Character.Destroying:Once(function() StopControlling(false) end),
}
Window:SelectTab(1)



ai
@tickingclock everything on here is ai at this point
@forsakenUPLOADER fair