Module script not sizing part to model size correctly

  1. What do you want to achieve? Keep it simple and clear!
    I am trying to make a module script clone a part, put it into a model, and make the part the same size as the model.

  2. What is the issue? Include screenshots / videos if possible!
    There are no errors in the output but whenever I run the game, parts being inserted which are coded to be the same size as the model appear larger than the model.

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I searched the DevForums and I have found no solutions.

Server script inside the model:

local MOD = require(game.ServerScriptService.MainScripts.Modules.HouseManagement.HitboxManager)
MOD.Addbox(script.Parent) -- the parent is always a model

Module script the server script is requiring:

local module = {

Addbox = function(house)
  local block = game.ReplicatedStorage.HouseSystem.Assets.Hitboxes.HouseHitbox:Clone() -- block is a part
  block.Parent = house
  block.Size = house:GetModelSize()
  block.CFrame = house:GetPivot()
end,

}

return module

I have multiple scripts running the module at the same time when the game starts. It seems the more scripts I add (for a different model each), the larger the hitbox gets. (One model has a perfect sized one, a few have double size, and the others are larger)

Model sizes:

Size of the parts being added:

Help is appreciated!

You should be using Model:GetExtentsSize. GetModelSize isn’t a function. I’m surprised it’s not throwing an error as a result of that.

I already tried doing this and it still gave me the same issue.

I discovered the issue myself. It’s another one of those silly mistakes (I was putting the box into the model at the box’s original position before changing it’s position, making the model size stretch to the box’s original position)

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