Make the players legs deal damage when the keycode C is pressed?
Hi, what i want to happen is so that the players legs deal damage (when you click C) when they touch another player but my problem is that the legs constantly deal damage,
please help
02 | local lleg = script.Parent:FindFirstChild( "Left Leg" ) |
03 | local rleg = script.Parent:FindFirstChild( "Right Leg" ) |
05 | local UIS = game:GetService( "UserInputService" ) |
06 | local character = script.Parent |
07 | local humanoid = character:WaitForChild( "Humanoid" ) |
08 | local DropAnim = Instance.new( "Animation" ) |
12 | local CanDropkick = false |
13 | local Keybind = Enum.KeyCode.E |
14 | local LeftLeg = game.Players.LocalPlayer.Character [ "Left Leg" ] |
15 | local RightLeg = game.Players.LocalPlayer.Character [ "Right Leg" ] |
18 | character.Humanoid.Running:Connect( function (speed) |
19 | if speed > topspeed then |
22 | else if speed < topspeed then |
32 | if hit.Parent ~ = nil then |
33 | local hum = hit.Parent:findFirstChild( "Humanoid" ) |
35 | hum.Health = hum.Health - 10 |
40 | lleg.Touched:connect(dmg) |
41 | rleg.Touched:connect(dmg) |
43 | UIS.InputBegan:Connect( function (input,gameprocessed) |
44 | if gameprocessed then return end |
45 | if not CanDropkick then return end |
46 | if not dmg then return end |
47 | if input.KeyCode = = Keybind then |
55 | local playAnim = character.Humanoid:LoadAnimation(DropAnim) |
58 | local drop = Instance.new( "BodyVelocity" ) |
59 | drop.MaxForce = Vector 3. new ( 1 , 0 , 1 ) * 30000 |
60 | drop.Velocity = character.HumanoidRootPart.CFrame.lookVector * 85 |
61 | drop.Parent = character.HumanoidRootPart |