Hey, so I have been working on a custom inventory system that uses part of roblox default tool system, the system uses a viewport frame which has a model where the tools are placed when equipped, the tools get removed after they get removed from the backpack or character.
However, I have noticed that when the tool is placed in the player’s backpack, the model cloned in the viewport frame looks messed up, I have spent more than a week trying to figure out the bug, with no luck.
-- The function which updates the gui, only showing the part where it clones the model since its the one thats giving the problem.
local GetRotateModelPart = RotateModel[Tools:GetAttribute("SlotNumber") or 1]
GetRotateModelPart.Model:ClearAllChildren()
GetRotateModelPart:SetAttribute("ToolTip", Adding and Tools.ToolTip or nil)
GetRotateModelPart:SetAttribute("Tool", Adding and Tools.Name or nil)
UpdateInformation()
if not Adding then return end
for i, Parts:Instance in ipairs(Tools:GetChildren()) do
if not Parts:IsA("BasePart") then Parts:Destroy() continue end
local NewPart = Parts:Clone()
NewPart.Parent = GetRotateModelPart.Model
if NewPart.Name ~= "Handle" then continue end
GetRotateModelPart.Model.PrimaryPart = NewPart
end
GetRotateModelPart.Model:PivotTo(GetRotateModelPart.CFramePart.CFrame)
-- the events to call the update gui functions
Backpack.ChildAdded:Connect(function(Child)
UpdateGui(Child, true)
end)
Backpack.ChildRemoved:Connect(UpdateGui)
Character.ChildAdded:Connect(function(Child)
UpdateGui(Child, true, true)
end)
Character.ChildRemoved:Connect(function(Child)
UpdateGui(Child, false, true)
end)
I have tried everything, I even tried looking at several other posts in the forums to find an answer, however it doesn’t seem like anyone is having the same problem
Cloned tool, thats parented to the character when its transformed into a model and parented to the viewportframe 3d inventory model.
Cloned tool, thats parented to the backpack when its transformed into a model and parented to the viewportframe 3d inventory model.