- -- ██▓███ ▓█████ ███▄ â–ˆ ▄████ â–ˆ ██ â–ˆ ██ â–Â██▌ â–Â██▌
- -- ▓██░ ██▒▓█ â–€ ██ ▀█ â–ˆ ██▒ ▀█▒ ██ ▓██▒ ██ ▓██▒ â–Â██▌ â–Â██▌
- -- ▓██░ ██▓▒▒███ ▓██ ▀█ ██▒▒██░▄▄▄░▓██ ▒██░▓██ ▒██░ â–Â██▌ â–Â██▌
- -- ▒██▄█▓▒ â–’â–’â–“â–ˆ â–„ ▓██▒ â–Â▌██▒░▓█ ██▓▓▓█ ░██░▓▓█ ░██░ ▓██▒ ▓██▒
- -- ▒██▒ ░ ░░▒████▒▒██░ ▓██░░▒▓███▀▒▒▒█████▓ ▒▒█████▓ ▒▄▄ ▒▄▄
- -- ▒▓▒░ ░ ░░░ ▒░ ░░ ▒░ ▒ ▒ ░▒ ▒ ░▒▓▒ ▒ ▒ ░▒▓▒ ▒ ▒ ░▀▀▒ ░▀▀▒
- -- â–‘â–’ â–‘ â–‘ â–‘ â–‘â–‘ â–‘â–‘ â–‘ â–’â–‘ â–‘ â–‘ â–‘â–‘â–’â–‘ â–‘ â–‘ â–‘â–‘â–’â–‘ â–‘ â–‘ â–‘ â–‘ â–‘ â–‘
- -- â–‘â–‘ â–‘ â–‘ â–‘ â–‘ â–‘ â–‘ â–‘ â–‘â–‘â–‘ â–‘ â–‘ â–‘â–‘â–‘ â–‘ â–‘ â–‘ â–‘
- -- â–‘ â–‘ â–‘ â–‘ â–‘ â–‘ â–‘ â–‘
- local freezeEntityToggle = true
- local attackEntityToggle = true
- local keybind = Enum.KeyCode.E
- local continueAttacking = false
- local function calculateDistance(pos1, pos2)
- return (pos1 - pos2).Magnitude
- end
- local function freezeEntity(entity)
- if not freezeEntityToggle then return end
- for _, part in pairs(entity:GetChildren()) do
- if part:IsA("BasePart") then
- part.Anchored = true
- end
- end
- end
- local function toggleAttack()
- continueAttacking = not continueAttacking
- end
- local function getEntityNames()
- local entityNames = {}
- for _, entity in pairs(workspace.Main.Live:GetChildren()) do
- if entity:IsA("Model") then
- table.insert(entityNames, entity.Name)
- end
- end
- return entityNames
- end
- local function onKeyPress(input)
- if input.KeyCode == keybind then
- toggleAttack()
- end
- end
- game:GetService("UserInputService").InputBegan:Connect(onKeyPress)
- local entityNames = {}
- spawn(function()
- while wait(1) do
- entityNames = getEntityNames()
- end
- end)
- while wait(0.1) do
- if not continueAttacking then
- continue
- end
- local player = game.Players.LocalPlayer
- local playerPosition = player.Character and player.Character:FindFirstChild("HumanoidRootPart") and player.Character.HumanoidRootPart.Position
- if not playerPosition then
- return
- end
- for _, entity in pairs(workspace.Main.Live:GetChildren()) do
- if table.find(entityNames, entity.Name) and entity ~= game.Players.LocalPlayer.Character then
- local entityRootPart = entity:FindFirstChild("HumanoidRootPart")
- if entityRootPart then
- local entityPosition = entityRootPart.Position
- local distance = calculateDistance(playerPosition, entityPosition)
- if distance <= 20 then
- if freezeEntityToggle then
- freezeEntity(entity)
- end
- if attackEntityToggle then
- local args = {
- [1] = {
- ["Victim"] = entity,
- ["Type"] = "Light",
- ["LocalInfo"] = {
- ["Flying"] = false
- },
- ["CurrentHeavy"] = 1,
- ["CurrentLight"] = 2,
- ["CurrentLightCombo"] = 1,
- ["VictimPosition"] = entityPosition,
- ["AnimSet"] = "Generic"
- }
- }
- game:GetService("ReplicatedStorage").Events.TryAttack:FireServer(unpack(args))
- end
- end
- end
- end
- end
- end