Weld Keeps Messing Up Builds

Hello, so I’m trying to script a tool for a customer, (I rarely build, just making this item a tool). And it just doesn’t want to get welded. Every time I weld it, it just flips for some reason. Any help would be appreciated.

Video showcasing what I’m talking about:
https://gyazo.com/a1ebdaf111323e394ec1894d4b113e66

Thank you for stopping by. :slight_smile:

1 Like

You need an auto weld script. Something like this

function weld(part1, part2)
     local w = Instance.new("Weld")
     w.Part0,w.Part1 = part1,part2
     w.C0 = part2.CFrame:toObjectSpace(part1.CFrame):inverse()
     w.Parent = part1
end

Just call it on the command line and send in part1 and part2

2 Likes

I usually always use Weld Constraints for tools, always works (without the needing to script it), for some reason this problem started occurring to be recently, is it something to do with my settings?

I’m not sure because I’m not a modeler, but when I do model I always find it easier to use an automatic weld script. I always keep one around.

Wrote this code, works well now, appreciated:
local weld = Instance.new("WeldConstraint", script.Parent)
local h = script.Parent.Handle
local p = script.Parent.Plate
weld.Part0 = h
weld.Part1 = p