What is the best way to make punch detection?

Do I use the Touched on the hand,
do I find parts in the region in front of the player,
or are there better ways to this?

I want to know the best way to make a punch script similar to games of rogue lineage or tales from the valley

1 Like

Just use hitbox, Making a part on the player hands, hitbox on the player, detect punch and when the player is punching change damage value to for exampel 10.

1 Like

I’ve made a punch system before, and I found that it’s easiest to use a touched event on the arm that is activated and deactivated based on player input.

Basically, when the player presses the punch button a script starts checking for hand.Touched events until you end the function when the player stops punching.

Example:

local debounce = some event that you connect from playerinput. 
game.Players.PlayerAdded:Connect(function(Player)
    Player.CharacterAdded:Connect(function(Character)
        Character:WaitForChild("Right Arm").Touched:Connect(function(hit)
            if debounce == true then wait() end
            if hit.Parent:FindFirstChild("Humanoid") then -- Check if its a player
                hit.Parent:FindFirstChild("Humanoid"):TakeDamage(10) -- Apply damage
            end
        end)
    end)
end)

This is just an example, you might want to look at these API references:

Listen the best and easiest way to do it, taking performance into regard as well, is easily, and by far magnitude.

1 Like