this is my first open source project so hope you guys find it useful
FastBox a quick way to make hitboxes for any developer
it is VERY easy to setup and get started with FastBox it is pretty well documented inside of the documentation script inside of the folder but i will go over it really quick
begin by requiring the module script and yes it should be placed in replicatedstorage
`
local FastBox = require(game:GetService("ReplicatedStorage"):WaitForChild("FastBox"):WaitForChild("FastBox"))
next up create an attachement under the part where you want the hitbox to be casted this can be done simply by doing this:
game.Players.PlayerAdded:Connect(function(plr) -- also use this in serverscriptservice before anyone asks
plr.CharacterAdded:Connect(function(Character)
local attachement = Instance.new("Attachment")
attachement.Name = "HitboxAttachement" -- name it whatever it doesnt matter
attachement.Parent = Character["Right Arm"]
end)
end)
now you have the prerequisites done next up we need to create the hitbox data this can be done by simply doing this:
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait() -- if you cant already tell this is a local script
local hitbox = FastBox.new({
Attachment = character:WaitForChild("Right Arm"):WaitForChild("HitboxAttachement"), -- put the attachement which you wanna use here
Size = Vector3.new(5,5,5), -- the size
Params = OverlapParams.new(), -- just copy this line if you dont wanna do anything special
})
now that you have created the hitbox there are a few methods which are very useful.
hitbox:HitStart() -- simple as that now the hitbox is detecting hits! dont worry it shouldnt hit the player whos casting the hitbox or anything other than the player
hitbox:HitStop() -- stops the hit detection very self explanatory
hitbox.OnHitEvent:Connect(function(character, humanoid) -- this will detect when the player hitbox hits another player
local event = Instance.new('RemoteEvent') -- random remote event i recommend using a networking library though
event:FireServer(character, humanoid) -- fires to the server so the server caa do the logic damage other player etc etc etc etc
end)
hitbox:IsActive() -- this will return if the hitbox is still active not the most useful but it has its use cases
hitbox:Destroy() -- this will basically destroy the connection and stop the hitbox from detecting hits
-- if you made it this far i highly recommend you use a distance checker on the server lol cus exploiters are gonna uh oh kill everyone
FastBox1.0.0.rbxm (9.6 KB)