What would I use for this

I’m basically giving every player a hitbox attached to them.

What do I use so that something triggers when the sword hits the player’s model, and it knows what player’s model it hit. (So I can fire a damage script or something)

why dont you just use the player model rather than a separate hitbox?

are you trying to find out if the sword hit the player in a certain spot?

Oh ok. Didnt think of that.

I will just use the player model.

Though back to my original question what would I use to signal what player got hit?

To clerify something will run when the sword hits another player’s model.

well, first off youd need to setup a .Touched event.
sword.Touched:connect(function(hit) --the hit argument is what the sword hit

then you’d check to see if it hit a playermodel, then get the player from the character

sword.Touched:connect(function(hit) --the hit argument is what the sword hit
     if hit.Parent:FindFirstChild('Humanoid') then
        local humanoid = hit.Parent:FindFirstChild('Humanoid') 
        local PlayerWhoGotHit = game.Players:GetPlayerFromCharacter(hit.Parent)
        
      --dealing damage to the player
       humanoid:TakeDamage(10)        
     end
end)

you can tweak that to your needs

Oh ok thanks.


Alternatively to touched you can use GetPartsInPart() or GetTouchingParts() which both provide an array of instances currently inside or touching any given BasePart instance respectively, then you can iterate over the items of the array and act accordingly.

This would be giving a sword a “hit area” not a player a “hit box”.

They wanted to know when the sword hit the player model, and the function i provided is a very basic example of how it can be done

I see that now, it also seems as if the thread was edited as it was initially asking about giving players hitboxes.

1 Like

Yes I edited the question because @letris notified that I could just use the players model.