Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why does my welding script not create a ManualWeld?

Asked by 7 years ago
local weld = Instance.new("ManualWeld")
weld.Part0 = script.Parent
weld.Part1 = script.Parent.Parent.GunHead
weld.C0 = script.Parent.CFrame:inverse() * script.Parent.Parent.GunHead.CFrame
weld.Parent = script.Parent

This code won't work, and I have no idea why. This Script is inside a Part that refuses to weld to my Tool. I always see it on one random spot on the map.

I've tried replacing weld.Parent = script.Parent with adding script.Parent as a second arugment to Instance.new, but no luck.

I've tried print(weld.Parent:GetFullName()) after weld.Parent = script.Parent, to which it gives the full hierarchy of where it SHOULD be.

However, the part does not weld and checking the explorer on the side shows it doesn't even create at all.

Why won't this part weld?

Answer this question