You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? Keep it simple and clear!
Make the Grey part align with the red part. (bottom of model)
What is the issue? Include screenshots / videos if possible!
I right now use bounding box and SetPrimaryCFrame/pivotto and end up with the grey part being under it yes, although it is not aligned with the true bottom.
local function generatePart(size)
local p = Instance.new("Part")
p.Size = size
p.Anchored = true
p.Color = Color3.new(0.6,0.2,0.2)
p.Parent = workspace
return p
end
local function alignPart(model : Model)
local hitbox = model.PrimaryPart
local part = generatePart(Vector3.new(hitbox.Size.X,1,hitbox.Size.Z))
part.CFrame = CFrame.new(hitbox.Position - (hitbox.CFrame.UpVector * (hitbox.Size.Y/2 + part.Size.Y/2)))*hitbox.CFrame.Rotation
end
alignPart(workspace.model)
I personally use this plugin for hitboxes:
If you don’t want the part to be generated, just replace the
-- Reference to the models you want to align
local modelToAlign = game.Workspace.ModelToAlign -- Replace "ModelToAlign" with the name of the model you want to align
local referenceModel = game.Workspace.ReferenceModel -- Replace "ReferenceModel" with the name of the model you want to align to
-- Check if both models exist
if modelToAlign and referenceModel then
-- Set the position, rotation, and scale of the modelToAlign to match the referenceModel
modelToAlign:SetPrimaryPartCFrame(referenceModel:GetPrimaryPartCFrame())
modelToAlign:SetPrimaryPartCFrame(modelToAlign:GetPrimaryPartCFrame() * referenceModel:GetPrimaryPartCFrame():PointToWorldSpace(CFrame.new()))
modelToAlign:SetPrimaryPartCFrame(CFrame.new(modelToAlign:GetPrimaryPartCFrame().p) * referenceModel:GetPrimaryPartCFrame())
-- Optional: You can also set other properties like transparency or visibility if needed
modelToAlign:SetPrimaryPartCFrame(referenceModel:GetPrimaryPartCFrame())
modelToAlign.Transparency = referenceModel.Transparency
modelToAlign.Visibility = referenceModel.Visibility
else
warn("One or both models not found!")
end