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

Tool arm welds not working online?

Asked by
guiraz 25
8 years ago

So I'm scripting a gun and I decided to weld the arms in a more realistic position, it all works fine in solo mode but not in online mode. In online mode the arms fall off, do I need a new way to remove the welds?

welds = {}

function onEquip()
    local ra = chr["Right Arm"]
    local la = chr["Left Arm"]
    local torso = chr["Torso"]

    local lweld = Instance.new("Weld", la) --left arm weld
    lweld.Part0 = la
    lweld.Part1 = torso
    lweld.C0 =  CFrame.new(1,0.5,0.5) * CFrame.Angles(math.rad(-90),math.rad(50),0)

    local rweld = Instance.new("Weld", ra) --right arm weld
    rweld.Part0 = ra
    rweld.Part1 = torso
    rweld.C0 =  CFrame.new(-1,0.5,0.5) * CFrame.Angles(math.rad(-90),math.rad(-10),0)

    local grip = ra:WaitForChild("RightGrip") --grip weld 
    grip.C1 = CFrame.new(0,0,-0.3)

    table.insert(welds, lweld)
    table.insert(welds, rweld)
end

function onUnequip()
    for _, weld in pairs(welds)do
        weld:remove()
    end
end

gun.Equipped:connect(onEquip)
gun.Unequipped:connect(onUnequip)

Answer this question