local Players = game:GetService("Players") local RunService = game:GetService("RunService") local UserInputService = game:GetService("UserInputService") local player = Players.LocalPlayer local mouse = player:GetMouse() local character, humanoid, root local function setupCharacter(char) character = char humanoid = char:WaitForChild("Humanoid") root = char:WaitForChild("HumanoidRootPart") end if player.Character then setupCharacter(player.Character) end player.CharacterAdded:Connect(setupCharacter) local ropeConstraint local beam local webAttach local swingActive = false local function getRayParams() local params = RaycastParams.new() params.FilterType = Enum.RaycastFilterType.Exclude params.FilterDescendantsInstances = {character} params.IgnoreWater = true return params end local function createBeam(attach0, attach1) local beam = Instance.new("Beam") beam.Attachment0 = attach0 beam.Attachment1 = attach1 beam.Color = ColorSequence.new(Color3.fromRGB(230, 230, 255), Color3.fromRGB(150, 150, 255)) beam.Width0 = 0.1 beam.Width1 = 0.05 beam.LightEmission = 0.8 beam.Texture = "rbxassetid://7309400641" beam.TextureMode = Enum.TextureMode.Wrap beam.TextureSpeed = 3 beam.FaceCamera = true beam.Parent = root return beam end local function releaseWeb() swingActive = false if ropeConstraint then ropeConstraint:Destroy() ropeConstraint = nil end if beam then beam:Destroy() beam = nil end if webAttach then webAttach:Destroy() webAttach = nil end end local function fireWeb() if swingActive then releaseWeb() return end if not root then return end local rayParams = getRayParams() local origin = root.Position + root.CFrame.LookVector * 2 local direction = (mouse.Hit.Position - origin).Unit * 300 local result = workspace:Raycast(origin, direction, rayParams) if not result or not result.Instance then return end local hitPart = result.Instance webAttach = Instance.new("Attachment") webAttach.Name = "WebAttach" webAttach.Position = hitPart.CFrame:PointToObjectSpace(result.Position) webAttach.Parent = hitPart local playerAttach = Instance.new("Attachment") playerAttach.Name = "WebPlayerAttach" playerAttach.Parent = root ropeConstraint = Instance.new("RopeConstraint") ropeConstraint.Attachment0 = webAttach ropeConstraint.Attachment1 = playerAttach ropeConstraint.Length = (result.Position - root.Position).Magnitude ropeConstraint.Visible = false ropeConstraint.Thickness = 0.1 ropeConstraint.Restitution = 0.2 ropeConstraint.Parent = root beam = createBeam(webAttach, playerAttach) swingActive = true local dir = (result.Position - root.Position).Unit root.Velocity = root.Velocity + dir * 50 + Vector3.new(0, 40, 0) end UserInputService.InputBegan:Connect(function(input, gp) if gp then return end if input.UserInputType == Enum.UserInputType.MouseButton1 then fireWeb() end end) RunService.Heartbeat:Connect(function() if swingActive and ropeConstraint and webAttach and webAttach.Parent then local anchorWorldPos = webAttach.WorldPosition local diff = anchorWorldPos - root.Position local distance = diff.Magnitude local maxLen = ropeConstraint.Length if distance > maxLen then local pull = diff.Unit * (distance - maxLen) root.Velocity += pull * 3 end if not webAttach.Parent or not webAttach.Parent:IsDescendantOf(workspace) then releaseWeb() end else if swingActive then releaseWeb() end end end)