-- Create the Tool instance local tool = Instance.new("Tool") -- Set the tool's properties tool.Name = "Swift Sweep" tool.RequiresHandle = false -- Set to true if you have a handle part tool.CanBeDropped = true -- Change as needed -- Add a description or other properties tool.ToolTip = "A swift sweeping tool for fast clean-ups." -- Animation IDs local animationId = "rbxassetid://16944345619" local pushBackAnimationId = "rbxassetid://10471478869" -- Push-back animation ID (replace with your animation ID if different) -- Trail texture ID local trailTextureId = "rbxassetid://3840203982" -- Damage parameters local minDamage = 10 local maxDamage = 14 local pushBackDistance = 15 -- Distance to push back the player -- Function to play the animation local function playAnimation() local player = game.Players.LocalPlayer local character = player.Character or player.CharacterAdded:Wait() local humanoid = character:WaitForChild("Humanoid") -- Load the animation local animation = Instance.new("Animation") animation.AnimationId = animationId local animationTrack = humanoid:LoadAnimation(animation) -- Play the animation animationTrack:Play() end -- Function to create a trail on the left leg local function createTrail() local player = game.Players.LocalPlayer local character = player.Character or player.CharacterAdded:Wait() local leftLeg = character:FindFirstChild("Left Leg") or character:FindFirstChild("LeftUpperLeg") if leftLeg then -- Create attachments for the trail local attachment0 = Instance.new("Attachment", leftLeg) local attachment1 = Instance.new("Attachment", leftLeg) attachment1.Position = Vector3.new(0, -2, 0) -- Adjust the position as needed -- Create the trail local trail = Instance.new("Trail") trail.Attachment0 = attachment0 trail.Attachment1 = attachment1 trail.Texture = trailTextureId trail.Lifetime = 0.9 -- Set the transparency to fade out trail.Transparency = NumberSequence.new({ NumberSequenceKeypoint.new(0, 0), -- Fully visible at the start NumberSequenceKeypoint.new(1, 1) -- Fully transparent at the end }) trail.Parent = leftLeg -- Optional: Remove the trail after it has completely faded out game:GetService("Debris"):AddItem(trail, 1.0) -- Slightly longer than lifetime to ensure complete removal end end -- Function to push back the player in front and deal damage after a delay local function pushBackAndDamage() local player = game.Players.LocalPlayer local character = player.Character or player.CharacterAdded:Wait() local humanoidRootPart = character:WaitForChild("HumanoidRootPart") local lookDirection = humanoidRootPart.CFrame.LookVector -- Perform a raycast in front of the player local raycastParams = RaycastParams.new() raycastParams.FilterDescendantsInstances = {character} raycastParams.FilterType = Enum.RaycastFilterType.Blacklist local raycastResult = workspace:Raycast(humanoidRootPart.Position, lookDirection * 20, raycastParams) -- Increased raycast distance to 20 studs if raycastResult and raycastResult.Instance and raycastResult.Instance.Parent:FindFirstChild("Humanoid") then local hitCharacter = raycastResult.Instance.Parent local hitHumanoidRootPart = hitCharacter:FindFirstChild("HumanoidRootPart") local hitHumanoid = hitCharacter:FindFirstChild("Humanoid") if hitHumanoidRootPart and hitHumanoid then -- Delay before applying damage, push-back, and playing the push-back animation wait(0.4) -- Calculate damage within the specified range local damage = math.random(minDamage, maxDamage) -- Apply damage to the hit player hitHumanoid:TakeDamage(damage) -- Calculate push-back direction and force local pushBackDirection = (hitHumanoidRootPart.Position - humanoidRootPart.Position).unit local pushBackForce = pushBackDirection * pushBackDistance -- Apply push-back force to the hit player hitHumanoidRootPart.Velocity = pushBackForce -- Load and play the push-back animation on the hit player local pushBackAnimation = Instance.new("Animation") pushBackAnimation.AnimationId = pushBackAnimationId local pushBackAnimationTrack = hitHumanoid:LoadAnimation(pushBackAnimation) pushBackAnimationTrack:Play() print("Dealt " .. damage .. " damage, pushed back player, and played push-back animation on player: " .. hitCharacter.Name) end else print("No player found in front.") end end -- Add functionality to the tool tool.Activated:Connect(function() playAnimation() createTrail() pushBackAndDamage() end) -- Add the tool to the player's backpack tool.Parent = game.Players.LocalPlayer.Backpack