How would i get a hitbox from a tool in a module?

Hey, I’m wondering how i will get my hitbox from my tool. I am making a combat system with multiple equipable weapons. I am using RaycastHitboxV4 and it requires the hitbox object to be in the parentheses.

local Combat = {}

--// Services
local ReplicatedStorage = game:GetService("ReplicatedStorage")

--// Assets
local Modules = ReplicatedStorage:WaitForChild("Modules")
local Assets = ReplicatedStorage:WaitForChild("Assets")
local Animations = Assets:WaitForChild("Animations")
local Sounds = Assets:WaitForChild("Sounds")

--// Modules
local RaycastHitboxV4 = require(Modules.Utility.RaycastHitboxV4)
local VFXModule = require(Modules.Main.VFXHandler)
local RagdollModule = require(Modules.Main.Ragdoll)

local newHitbox = RaycastHitboxV4.new( ) --problem is here

return Combat
1 Like

Isn’t it just creating a invisible part that has the same size of the weapon and it is welded to it? Or just the weapon model maybe works too.

2 Likes

It’s a tool with a hitbox welded

1 Like

so just put the hitbox in the parentheses

2 Likes

Im making an all in one melee combat system handler and i need to get the hitbox of each tool i equip

1 Like

If every tool has a hitbox in it, just detect when the player equips a tool, get the tool and get the hitbox in it and then put it on parentheses

2 Likes

Will that run in a modulescript or a normal script? Sorry im kinda bad at scripting lmao

A normal script I guess. Smth like:


game:GetService("Players").PlayerAdded:Connect(function(plr)

    local character = plr.Character or plr.CharacterAdded:Wait()
    
    chararacter.DescendantAdded:Connect(function(descendant)

        --detect if descendant is tool and then you have the tool and hitbox.

    end)

end)

Thank you so much it worked! :partying_face:

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.