For example this is the part of my code
HitboxSystem
type Hitbox = {
player: Player,
hitboxId: string,
originPart: BasePart,
offset: CFrame,
size: Vector3,
}
local RegisteredHitboxes: { [string]: Hitbox } = {}
function HitboxSystem.register(params: hitboxParams)
local hitbox: Hitbox = {
player = params.player,
hitboxId = params.hitboxId,
originPart = params.originPart,
offset = params.offset,
size = params.size,
}
RegisteredHitboxes[params.hitboxId] = hitbox
end
Should I check all like this?
if typeof(params.hitboxId) ~= "string" then
warn("The type of hitbox id isn't match.")
return
end
--And
if not params.hitboxId then
warn("Hitbox id is nil.")
return
end