I made a small script to automatically weld and assign hitboxes to a pet pack i got. the results were not as expected…
The script:
local PetPack = game.Workspace.PetPack
for i, v in pairs(PetPack:GetChildren()) do
local hitbox = Instance.new("Part", v)
hitbox.Name = "Hitbox"
hitbox.Transparency = 1
hitbox.Size = v:GetExtentsSize()
hitbox.CastShadow = false
hitbox.CFrame = v:GetModelCFrame()
for i2, v2 in pairs(v:GetChildren()) do
if v2 ~= hitbox and v2:IsA("BasePart") then
local weld = Instance.new("WeldConstraint", hitbox)
weld.Part0 = hitbox
weld.Part1 = v2
end
end
v.PrimaryPart = hitbox
end
(the objects in the pet pack folder are all models)
I got this as a result:
Whats wrong here? I already tested anchoring it and reexecuting the script, same result.
Pet pack that was used: Pet Pack - Roblox
