OP SWING OPEN SOURCE
Key Required

OP SWING OPEN SOURCE

Dead RailsItzPnsdgItzPnsdg 819 views 49 executesUpdated Mar 28, 2026
Unrated
00
Lua Script•113 lines (2704 chars)
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")

local ClientMeleeHandler = require(ReplicatedStorage.Client.Game.Melee.ClientMeleeHandler)
local originalHandler = ClientMeleeHandler._meleeActionHandler

local StopSpam = false
local spamConnection = nil
local currentMeleeTool = nil
local currentAttackTime = nil
local currentLookVector = nil

local SwingDelay = 0.05
local SwingsPerDelay = 2

ClientMeleeHandler._meleeActionHandler = function(actionName, inputState, inputObject)
    if inputState == Enum.UserInputState.Begin then
        StopSpam = false
        startSwing()
    elseif inputState == Enum.UserInputState.End then
        StopSpam = true
        stopSpamSwing()
    end
    
    if originalHandler then
        return originalHandler(actionName, inputState, inputObject)
    end
end

function Swing()
    if not currentMeleeTool or not currentAttackTime or not currentLookVector then
        return
    end
    
    ReplicatedStorage.Shared.Universe.Network.RemoteEvent.SwingMelee:FireServer(
        currentMeleeTool,
        currentAttackTime,
        currentLookVector
    )
end

function startSwing()
    local LocalPlayer = Players.LocalPlayer
    local character = LocalPlayer.Character
    
    if not character then
        return
    end
    
    currentMeleeTool = character:FindFirstChildWhichIsA("Tool")
    if not currentMeleeTool then
        return
    end
    
    currentAttackTime = workspace:GetServerTimeNow()
    
    local mouse = LocalPlayer:GetMouse()
    if mouse and mouse.Hit then
        currentLookVector = mouse.Hit.LookVector
    else
        currentLookVector = character:GetPivot().LookVector
    end
    
    stopSpamSwing()
    spamConnection = RunService.Heartbeat:Connect(function()
        if StopSpam then
            return
        end
        spamswing()
    end)
end

function stopSpamSwing()
    if spamConnection then
        spamConnection:Disconnect()
        spamConnection = nil
    end
end

function spamswing()
    if StopSpam then
        return
    end
    
    for i = 1, SwingsPerDelay do
        if StopSpam then
            break
        end
        Swing()
        task.wait(SwingDelay)
    end
end

local function cleanup()
    stopSpamSwing()
    if ClientMeleeHandler then
        ClientMeleeHandler._meleeActionHandler = originalHandler
    end
end

script:GetPropertyChangedSignal("Enabled"):Connect(function()
    if not script.Enabled then
        cleanup()
    end
end)

Players.LocalPlayer.CharacterAdded:Connect(function()
    currentMeleeTool = nil
    if not StopSpam then
        StopSpam = true
    end
end)

Features & Information

make you melee weapons more powerful than gun

Community Comments (1)

Galaxy7657y3Galaxy7657y3Jun 19, 2026

thank you for the script and spread the gospel

More Scripts for Dead Rails