Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Tips for a fist combat system?

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

✓ Accepted answer

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.

This discussion is preserved as it was. New answers, comments, and votes are closed.