local Players = game:GetService("Players") local RunService = game:GetService("RunService") local TweenService = game:GetService("TweenService") local UIS = game:GetService("UserInputService") local player = Players.LocalPlayer local camera = workspace.CurrentCamera local swinging = false local swingForce = nil local hrpAttachment = nil local ropeEndPart = nil local endAttachment = nil local beam = nil local function GetCharacter() return player.Character or player.CharacterAdded:Wait() end local gui = Instance.new("ScreenGui") gui.Name = "SwingGui" gui.ResetOnSpawn = false gui.IgnoreGuiInset = true gui.Parent = player:WaitForChild("PlayerGui") local btn = Instance.new("TextButton") btn.Size = UDim2.new(0,200,0,80) btn.Position = UDim2.new(1,-110,1,-210) btn.AnchorPoint = Vector2.new(1,1) btn.Text = "Swing" btn.Font = Enum.Font.GothamBold btn.TextSize = 24 btn.TextColor3 = Color3.new(1,1,1) btn.BackgroundColor3 = Color3.fromRGB(255,140,0) btn.AutoButtonColor = true btn.Parent = gui local corner = Instance.new("UICorner", btn) corner.CornerRadius = UDim.new(0,10) local scale = Instance.new("UIScale", btn) task.spawn(function() while btn.Parent do TweenService:Create(scale, TweenInfo.new(0.5, Enum.EasingStyle.Sine, Enum.EasingDirection.Out), {Scale=1.05}):Play():Completed():Wait() TweenService:Create(scale, TweenInfo.new(0.5, Enum.EasingStyle.Sine, Enum.EasingDirection.In), {Scale=1}):Play():Completed():Wait() end end) local function StartSwing() if swinging then return end swinging = true local char = GetCharacter() local hrp = char:WaitForChild("HumanoidRootPart") swingForce = Instance.new("BodyVelocity") swingForce.MaxForce = Vector3.new(1,1,1)*1e5 swingForce.P = 1e4 swingForce.Parent = hrp hrpAttachment = Instance.new("Attachment", hrp) hrpAttachment.Name = "SwingAttachment" ropeEndPart = Instance.new("Part", workspace) ropeEndPart.Size = Vector3.new(0.2,0.2,0.2) ropeEndPart.Anchored = true ropeEndPart.CanCollide = false ropeEndPart.Color = Color3.fromRGB(0, 0, 0) ropeEndPart.Transparency = 1 endAttachment = Instance.new("Attachment", ropeEndPart) endAttachment.Name = "EndAttachment" beam = Instance.new("Beam", hrp) beam.Attachment0 = hrpAttachment beam.Attachment1 = endAttachment beam.FaceCamera = true beam.Width0 = 0.2 beam.Width1 = 0.2 beam.Color = ColorSequence.new(Color3.fromRGB(255, 255, 255)) RunService:BindToRenderStep("SwingLoop", Enum.RenderPriority.Character.Value+1, function() if not swinging then return end local dir = camera.CFrame.LookVector swingForce.Velocity = dir * 60 + Vector3.new(0,15,0) local ropeLength = 15 ropeEndPart.CFrame = CFrame.new(hrp.Position + dir*ropeLength) end) end local function StopSwing() if not swinging then return end swinging = false RunService:UnbindFromRenderStep("SwingLoop") if swingForce then swingForce:Destroy() end if hrpAttachment then hrpAttachment:Destroy() end if endAttachment then endAttachment:Destroy() end if ropeEndPart then ropeEndPart:Destroy() end if beam then beam:Destroy() end end btn.MouseButton1Down:Connect(StartSwing) btn.MouseButton1Up:Connect(StopSwing) btn.MouseLeave:Connect(StopSwing) btn.InputEnded:Connect(function(input) if input.UserInputType == Enum.UserInputType.Touch or input.UserInputType == Enum.UserInputType.MouseButton1 then StopSwing() end end) UIS.InputEnded:Connect(function(input) if swinging and (input.UserInputType == Enum.UserInputType.Touch or input.UserInputType == Enum.UserInputType.MouseButton1) then StopSwing() end end)