function Weldnow() local w1 = Instance.new("Weld") w1.Parent = script.Parent.Handle w1.Part0 = w1.Parent w1.Part1 = script.Parent.Barrel end script.Parent.Equipped:connect(Weldnow) script.Parent.Unequipped:connect(Weldnow)
this is my Script, it keeps pulling the Pieces together! so the Bullet shoots Down... plz help me here, how would I weld them without them being in the same Position?
Edit: tried this
function weldBetween(a, b) local weld = Instance.new("ManualWeld") weld.Part0 = script.Parent.Handle weld.Part1 = script.Parent.Barrel weld.C0 = CFrame.new() weld.C1 = b.CFrame:inverse() * a.CFrame weld.Parent = a return weld; end weldBetween(script.Parent.Handle, script.Parent.Barrel) script.Parent.Equipped:connect(weldBetween) script.Parent.Unequipped:connect(weldBetween)
and this
function weldBetween(a, b) local weld = Instance.new("ManualWeld") weld.Part0 = a weld.Part1 = b weld.C0 = CFrame.new() weld.C1 = b.CFrame:inverse() * a.CFrame weld.Parent = a return weld; end weldBetween(script.Parent.Handle, script.Parent.Barrel) script.Parent.Equipped:connect(weldBetween) script.Parent.Unequipped:connect(weldBetween)
but for these 2 it did fine, but except, it says either b is a nil Value or something else... sry I forgot about the other Error... this Stupid Output doesn't sho me the Old Errors for some Reason...
Put this in a LocalScript
function Weld(x,y) local W = Instance.new("Weld") W.Part0 = x W.Part1 = y local CJ = CFrame.new(x.Position) local C0 = x.CFrame:inverse()*CJ local C1 = y.CFrame:inverse()*CJ W.C0 = C0 W.C1 = C1 W.Parent = x end function Get(A) if A.className == "Part" then Weld(script.Parent.Handle, A) A.Anchored = false else local C = A:GetChildren() for i=1, #C do Get(C[i]) end end end function Finale() Get(script.Parent) end script.Parent.Equipped:connect(Finale) script.Parent.Unequipped:connect(Finale) Finale()