So basically I created a cup tool and I added a weld script. When I test the game and put the cup in StarterPack the actual cup container thing is invisible as well as the ring on top of it. Why is this happening? The 2 parts that I can't see when I play are called 'Cup' and 'Ring'. I even went into test mode, went to my character and selected the 2 parts in explorer and it shows it's where it's supposed to be: https://gyazo.com/3fb2718bac5b97f5bd926ff7a3c6f69c
Here is the code inside the weld script:
local prev local parts = script.Parent:GetChildren() for i = 1,#parts do if ((parts[i].className == "Part") or (parts[i].className == "Handle") or (parts[i].className == "WedgePart") or (parts[i].className == "Seat") or (parts[i].className == "TrussPart") or (parts[i].className == "VehicleSeat") or (parts[i].className == "UnionOperation") or (parts[i].className == "SkateboardPlatform")) then if (prev ~= nil) then local weld = Instance.new("Weld") weld.Part0 = prev weld.Part1 = parts[i] weld.C0 = prev.CFrame:inverse() weld.C1 = parts[i].CFrame:inverse() weld.Parent = prev parts[i].Anchored = false end prev = parts[i] end end wait(3)
Cup Parts: https://gyazo.com/4c260cf33f88c2cedd229f455184b9d1
What the cup is supposed to look like: https://gyazo.com/d964a2420528a3473c9f35fc4ec01d84
What it looks like when I hold it: https://gyazo.com/f8399c109216af24672db62e740154a9
function Weld(p) local Parts = p:GetChildren() local Prev for i, v in pairs(Parts) if v:IsA("BasePart") then if Prev then local Weld = Instance.new("Weld") Weld.Name = Prev.Name .. "_" .. v.Name Weld.Part0 = Prev Weld.Part1 = v Weld.C0 = Weld.Part0.CFrame:inverse() Weld.C1 = Weld.Part1.CFrame:inverse() Weld.Parent = Prev end Prev = v end end -- Unanchor parts for i, v in pairs(Parts) do if v:IsA("BasePart") or v:IsA("MeshPart") then v.Anchored = false end end end
If the code is the problem, this should make a difference. I wrote it up in an external ide without code completion. If it doesn't work I'll test it in studio.
Fixed. MeshPart apparently inherits class BasePart. Removed redundant check.