Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

I have a problem with my weld script

I am trying to weld 2 objects, named Engine2 and Wing1 and I am also putting a function where I touch a brick and both of them move. I really need help on how to stick them together so that one of them don't go off alone.

local function weldBetween(a, b)
    local weld = Instance.new("ManualWeld")
    weld.Engine.Engine2 = a
    weld.Engine.Wing1 = b
    weld.C0 = CFrame.new()
    weld.C1 = b.CFrame:inverse() * a.CFrame
    weld.Parent = a
    return weld;
end

weldBetween(game.Workspace.Engine.Engine2, game.Workspace.Engine.Wing1)

The output window says " Engine is not a valid member of ManualWeld "

I do not understand it, can anyone help me?

~Thanks for reading this, Yeevivor4

1 answer

✓ Accepted answer

All that means is that Engine is not a property.

Try this:

local function weldBetween(a, b)
	local weld = Instance.new("Weld")
	weld.Part0 = nil --replace nil with the location of the item i.e game.Workspace.Part, or a
	weld.Part1 = nil --replace nil with the location of the second item ie game.Workspace.Part2, or b
	--Remember: Part0 moves to be Part1!
	weld.C0 = CFrame.new(--[[CFrame value here!--]])
	weld.C1 = b.CFrame:inverse() *a.CFrame
	weld.Parent = a
	return weld;
end

This discussion is preserved as it was. New answers, comments, and votes are closed.