How to create and use HITBOX

hello developers!


create Folder in workspace and rename folder for “Ignore”
create “Part” and move it to “ServerStorage” and rename part to “HitBox”


Part Settings:
CanColide=false
Anchored=true
Size = 0,0,0
transparency=1


Using HitBox Script:


local Debris = game:GetService("Debris")
local destroyHBtime = .01
local Player = game.Players.LocalPlayer
local Character = Player.Character
local hitBox = game.ServerStorage:FindFirstChild("HitBox"):Clone()
hitBox.Size = Vector3.New(6,6,6)
local currentOffset = Character:GetPivot()
hitBox:PivotTo(currentOffset * CFrame.new(0,0,-2.5))
hitBox.Parent = workspace.Ignore

Debris:AddItem(hitBox,destroyHBtime)

local hitBoxOverlapParams = OverlapParams.new()
hitBoxOverlapParams.FilterType = Enum.RaycastFilterType.Exclude
hitBoxOverlapParams.FilterDescendantsInstances = {workspace.Ignore, Character} -- hitbox ingore

local hitsParts = workspace:GetPartsInPart(hitBox, hitBoxOverlapParams) -- hits
local alreadyHits = {} 
if #hitBox ~= 0 then
	for i,v in hitParts do
		local humanoid = v.Parent:FindFirstChild("Humanoid")
		if humanoid then
			if not table.find(alreadyHit,humanoid) then -- if hit then
				humanoid:TakeDamage(10)
				table.insert(alreadyHit,humanoid) 
			end	
		end
	end
end


this script needs to be done in events


game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function()
-- script
end)

GOODLUCK!


8 Likes

Is this asking for an entire system or is this supposed to be resources for others?

If its resources for others, please list it as Community Resources instead.

If you need an entire system for this, refrain from asking for that as it is against what DevForum is for.

3 Likes

sorry, it’s just my first post, I wanted to create a tutorial

3 Likes

I am pretty sure this wouldn’t work too well, did you even test this before posting it?

The system is completely Client Sided, which means it wont actually do any damage to anyone, it will just look like it.

Posting things like this that don’t truly work as intended isn’t really a good idea. (Unless its supposed to be like a half challenge or something, that still wouldn’t make too much sense to post as a Community Resource however.)

1 Like

I wrote at the end that this script should be used on RemoteEvents

2 Likes

Change the category to #resources:community-resources so the mods dont take the post down.

This seems good in community resource. You should tell people what it does in the post so there is no confusion, but what is a use for this?

4 Likes

I don’t see why we should use this over other hitbox systems such as:

You could give it more features that outplay other hitboxes, unique to your system to appeal to others.

Useful features, I mean.

3 Likes

this is a hitbox tutorial for beginners so they understand how it works

1 Like

…on what?

What is this a tutorial for?

2 Likes

in order for newbie developers to understand the principle work of hitbox

2 Likes

What is “Hitbox”?

I’m confused why people wouldn’t just go to Youtube instead of this, there are plenty more tutorials there.

2 Likes

it is more convenient for someone to read and its is faster

2 Likes