Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do i make my dropkick script do damage in roblox?

Asked by 2 years ago

how do i make this script deal damage to a player? what i have here is a dropkick script, i already added the leg tables and i dont know what to do next. basically what i want to achieve is to make a player deal damage when their legs touch an enemy. please help

--Made By 123Marooxd123


local UIS = game:GetService("UserInputService")
local character = script.Parent
local humanoid = character:WaitForChild("Humanoid")
local DropAnim= Instance.new("Animation")
DropAnim.AnimationId = "rbxassetid://9642052968"

local CanDropkick = false
local Keybind = Enum.KeyCode.E
local LeftLeg = game.Players.LocalPlayer.Character["Left Leg"]
local RightLeg = game.Players.LocalPlayer.Character["Right Leg"]



local Table = {LeftLeg,RightLeg}

local topspeed = 25
character.Humanoid.Running:Connect(function(speed)
    if speed > topspeed then
        CanDropkick = true

    else if speed < topspeed then
            CanDropkick = false

        end
    end
end)

humanoid:GetPropertyChangedSignal("FloorMaterial"):Connect(function()
    if humanoid.FloorMaterial == Enum.Material.Air then
        CanDropkick = true

    else if humanoid.FloorMaterial == Enum.Material.Ground then
            CanDropkick = false

        end
    end
end)

UIS.InputBegan:Connect(function(input,gameprocessed)
    if gameprocessed then return end
    if not CanDropkick then return end
    if input.KeyCode == Keybind then
        CanDropkick = false

        local playAnim = character.Humanoid:LoadAnimation(DropAnim)

        playAnim:Play()
    local drop = Instance.new("BodyVelocity")
    drop.MaxForce = Vector3.new (1,0,1) *30000
    drop.Velocity = character.HumanoidRootPart.CFrame.lookVector * 85
    drop.Parent = character.HumanoidRootPart

        for count = 1, 8 do
    wait(0.13)
    drop.Velocity*= 0.5
        end

    playAnim:Stop()
    drop:Destroy()
        CanDropkick = true

        end
    end)

Answer this question