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

I have a problem with my weld script

Asked by
Yeevivor4 155
10 years ago

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

Log in to vote
0
Answered by 10 years ago

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
Ad

Answer this question