#Is this Optimized

1 messages · Page 1 of 1 (latest)

hearty ledge
#

Im playing with a ShapeCast module and got too lazy to make DmgPoints so I tried to automate it, is this script optimized though?

local Module = require(game.ReplicatedStorage.ShapecastHitbox)

local part = script.Parent

local ResolutionX = 5
local ResoultionY = 2
local ResoultionZ = 2


local PartSizeX = part.Size.X
local PartSizeY = part.Size.Y
local PartSizeZ = part.Size.Z

for DmgPointX = 1, ResolutionX do
    for DmgPointY = 1 , ResoultionY do
        for DmgPointZ = 1, ResoultionZ do
            local XPosition = (PartSizeX/ResolutionX * DmgPointX) - PartSizeX/2
            local YPosition = (PartSizeY/ResoultionY * DmgPointY) - PartSizeY/2
            local ZPosition = (PartSizeZ/ResoultionZ * DmgPointZ) - PartSizeZ/2
            local Attachment = Instance.new("Attachment", part)
            Attachment.Name = "DmgPoint"
            Attachment.Position = Vector3.new(XPosition, YPosition, ZPosition)
        end
    end
end


local Hitbox = Module.new(script.Parent)
local function Touched(Result)
    local hit = Result.Instance
    if hit.Parent:FindFirstChild("Humanoid") then
        hit.Parent.Humanoid:TakeDamage(10)
    end
end

Hitbox:OnHit(Touched)
Hitbox:HitStart()
Module.Settings.Debug_Visible = true```
storm dove
#

seems okay to me