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

55 comments
why are you using free models
Sounds to me like it's just taking a while to render? Probably not a script issue.
@incapaxian Roblox uses a system which is now derogatorily called free models in which developers can share their creations and allow new developers to create games with minimal code.
Unity and Unreal engine use similar systems. The difference being, they call it blueprints.
The cup isn't a free model. My friend sent me the script. Also, I highly doubt it's a rendering issue as I held the cup for like a minute and still it didn't do anything.
It's not frowned upon in the real world. People do the work then share the work for others to use. As with any similar system, the items, scripts, objects, etc you take may not be of the best quality. At least in Roblox, it's free.
Alright. I'll take a look at the script.
You said when you select the objects while the tool is equipped, the hit box for those objects is in the correct place?
Is the Cup inside of a Part called Handle?
Yes.
I had to ask
Have you tried Unioning the parts instead of welding?
Also, can you guys stop arguing about free models. This is supposed to be for helping people not arguing. Yes, the script is a free model but does that really matter?
How would I do that, simplealgorithm?
No it doesn’t
You could actually just use a mesh instead, that way it's perfect everytime
Select the amount of parts that should be touching each other, I believe the tool is in the Model section of the banner in Studio, click Union
That was my point. Instead of helping he was ridiculing the use of free models which is unecessary.
I don't know how to create meshes. That's why I stick to creating things with Roblox parts. Also, yes all the parts that are needed to be unioned are unioned. I thought you meant with the script.
I still think it's a render issue. Or the model uses MeshParts or unions that have bugged out or are not opensourced.
Yes a mesh is preferred but it’s tough to figure out if you’re new, also have you defined exactly what prev was being nil,
Yes a mesh is preferred but it’s tough to figure out if you’re new, also have you defined exactly what prev was being nil?
That's the usual problem with stuff like this
It doesn’t seem that you’re really checking if the value was nil, after all it’s not even tied to anything, the value only is actually set after the weld
I've used this script before on other items and it has worked. I'm not sure what's happening this time though.
The script itself looks fine. Aside from poor techniques.
ROBLOX Updates the Studio whilst deprecating things and not telling us, it happens a lot, things will break with no provided fix
You’ll have to get used to it;)
The thing is, I tested out one of my old items and it works perfectly fine. It uses the exact same script.
Try setting the welds parent as the first thing, not the last?
Didn't work. :/ I know the part is in the right place but the thing is, you just can't see it.
Line 7 should set the parent
Hmm:/
Should I try to rebuild the cup?
It’s something to do with the variable prep, I think it’s because you never set prev to anything for the first object, as prev means the second
SH is not a site to get help with scripts you did not create.
No. Prev is being set to the first object in iteration. No welds are created until after Prev has been set. That's not an issue.
Just try moving the prev variable set above the if statement?
Oh, right, prev is a Global variable not Local, I’m stupid
It's checking if prev is nil. If prev is nil, we skip right over that if statement and set prev so we can run the next iteration.
Which if statement?
F
If prev
After it does it's extremely long and complex check to make sure the object being welded is a base part, it checks.
But I’m wrong, I know AZDev, I Script too;)
if (prev ~= nil) then
You may script. But it's clear you don't understand the code.
Now it completely doesn't work.
I've tried a bunch of different weld scripts but it still doesn't show those two parts. I might just need to rebuild the cup.
@TypicallyPacific Is it my script? If not, give mine a go. If it doesn't work, I'll get it fixed.
Your script isn't working either. I feel like it's a glitch with Roblox studio when I built it. No weld script is working. I may try to rebuild the cup and add the weld script back.
I just tried to separate the cup union and it disappeared.
It was a corrupt union.
I am not so great with welds, I could do it before, not anymore;) Looks like I have something to learn
I had to rebuild it. Sorry for making you try to fix the script :/