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

Tips for a fist combat system?

Asked by 3 years ago

I'm not very good at scripting, but I want to make a combat system. I've been trying different methods for 2 weeks, but none of them work. Other people's methods are using Touched for the hit detection and Region3 for hit detection. I personally want to use Region3 but I want to know how to make a hitbox that follows your humanoid Root Part but I don't know how. Any tips for making a Region3 combat system?

1 answer

Log in to vote
-3
Answered by 3 years ago

I use the :GetTouchingParts() method.

Create a "hitbox" infront of the player; insert a part, make it any size you want, then position it infront of the player.

Give the new part a Touched event, this is to allow GetTouchingParts() to also detect parts with no collision.

You can then do something like this :

for _, PartTouching in pairs(hitbox:GetTouchingParts()) do
    local Humanoid = PartTouching.Parent:FindFirstChild('Humanoid')
    if Humanoid then
        Humanoid:TakeDamage(5)
    end
end

Note, hitboxes may not be positioned correctly on the server, mostly due to ping ( especially when the player moves forward ), you can fix this by checking if they're moving forward and then set the hitbox a bit more forward according to their speed.

Im not very good at explaining but if you did understand what I meant then awesome job me.

Ad

Answer this question