You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? I want the items shown to be normally in the GUI like this:
-
What is the issue? Include screenshots / videos if possible! It looks like this in the GUI:
-
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I tried removing any welds so the parts would not be welded to the Handle when it gets resized but it does not seem to work
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
local m = Instance.new("Model")
m.Name = ""
m.Parent = player.Character
objs = {}
local scale
if model:IsA("BasePart") then
scale=1/5
local function recurse(obj)
for _,v in pairs(obj:GetChildren()) do
local part
if v:IsA("BasePart") then
part = v:clone()
elseif v:IsA("Hat") and v:findFirstChild("Handle") then
part = v.Handle:clone()
end
if part then
if part:FindFirstChildOfClass("Weld") then
local weld = part:FindFirstChildOfClass("Weld")
weld:Destroy()
elseif part:FindFirstChildOfClass("WeldConstraint") then
local weld = part:FindFirstChildOfClass("WeldConstraint")
weld:Destroy()
end
local cf = part.CFrame
part.Anchored = true
part.Parent = m
local orig=part.Size
part.Size=part.Size*scale
local mesh=part:FindFirstChild("Mesh")
if mesh then
mesh.Scale=mesh.Scale*scale
end
if mesh==nil then
local mesh=Instance.new("BlockMesh",part)
mesh.Scale=orig*scale/part.Size
end
local fire=part:FindFirstChildOfClass("Fire")
if fire then
fire.Size=fire.Size*scale
end
part.CFrame=CFrame.new(Vector3.new(0,0,0)+cf.p*scale)*(cf-cf.p)
if part:findFirstChild("Decal") and part.Transparency ~= 0 then
part:Destroy()
elseif part.Name == "Head" then
part.Name = "H"
end
if part.Parent == m then
table.insert(objs,part)
end
elseif not v:IsA("Model") and not v:IsA("Sound") and not v:IsA("Script") then
v:clone().Parent = m
else
recurse(v)
end
end
end
recurse(model.Parent)
end
local primary = Instance.new("Part")
primary.Anchored = true
primary.Transparency = 1
primary.CanCollide = false
primary.Name = "MODEL_CENTER"
primary.FormFactor = "Custom"
primary.Size = m:GetExtentsSize()
primary.CFrame = CFrame.new(m:GetModelCFrame().p)
primary.Parent = m
m.PrimaryPart = primary
for _,v in pairs(objs) do
v.Anchored = false
v.CanCollide = false
v.Archivable = true
local w = Instance.new("Weld",primary)
w.Part0 = primary
w.Part1 = v
local CJ = CFrame.new(primary.Position)
w.C0 = primary.CFrame:inverse()*CJ
w.C1 = v.CFrame:inverse()*CJ
v.Parent = m
end
CF = CFrame.new(0, 0, 0, -1, 0, -8.74227766e-008, 0, 1, 0, 8.74227766e-008, 0, -1)
Active = false
DistOffset = 0
function index:SetActive(b)
Active = b
end
function index:SetCFrame(cf)
CF = cf
end
local function updateModel()
primary.Anchored = false
if Active then
local posZ = GetDepthForWidth(primary.Size.magnitude, guiObj.AbsoluteSize.Y)
local sizeX,sizeY = guiObj.AbsoluteSize.X,guiObj.AbsoluteSize.Y
local posX,posY = guiObj.AbsolutePosition.X+(sizeX/2),guiObj.AbsolutePosition.Y+(sizeY/2)
local pos = ScreenSpaceToWorld(posX,posY,posZ)
local location = camera.CoordinateFrame * CFrame.new(pos.X, pos.Y, posZ)
primary.CFrame = location * CF
else
primary.CFrame = CFrame.new()
end
primary.Anchored = true
end
local con = rs.RenderStepped:connect(updateModel)
function index:End()
con:disconnect()
pcall(function ()
m:Destroy()
end)
return
end
index.Object3D = m
return index
^^^This is the module I used to show the model
function DisplayItem(item)
if model3D then
model3D:End()
end
local weapon = game.ReplicatedStorage.Items:FindFirstChild(item)
model3D=Module3D:Attach3D(weapon.Handle)
model3D:SetActive(true)
runservice.RenderStepped:connect(function()
model3D:SetCFrame(CFrame.Angles(0,tick()%math.pi*2,0))
end)
end
^^^How I use the module to show the item
Items are basically consisted of a Model then a Handle, then parts of the models that are welded to the Handle. Please help!