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

Arm weld works fine in studio, but breaks on server?

Asked by 6 years ago

Hi there, scripters! I'm having a problem with a weld (that is created through Instance) in my game. When you equip a tool, a weld is created, where Part0 is the player's torso and Part1 is the player's left arm. Once the tool is unequipped, this weld is deleted, and the player's left arm naturally positions itself to its former position. When tested on a server, the weld accordingly works, but the player's left arm falls into the ground. Any help is appreciated, thanks!

In case you need the script, here it is (it's server-sided):

function script.Parent.WeldArm.OnServerInvoke(player,equipped,position,angles)
    if equipped == true then
        local weld = Instance.new("Weld")
        weld.Part0 = player.Character.Torso
        weld.Parent = player.Character.Torso
        weld.Part1 = player.Character:FindFirstChild("Left Arm")
        weld.C1 = position * angles
    else
        if equipped == false then
            player.Character.Torso:FindFirstChild("Weld"):Destroy()
        end
    end
end
0
RemoteFunction are required to return a value. Since you're not returning use a RemoteEvent. User#19524 175 — 6y
0
Okay, would this fix the problem? SnazzySpider67 53 — 6y
0
Im not sure. But try it. Also, line 9 is unnecessary as the 'else' keyword does this for you, and == true/false is not needed either. User#19524 175 — 6y
0
I just added it, in case I wanted to reposition the arm while reloading the weapon. This way the "equipped" argument wouldn't be necessar SnazzySpider67 53 — 6y
View all comments (4 more)
0
This didn't fix the problem, but thanks for the help anyways SnazzySpider67 53 — 6y
0
Returning value has nothing to do with the problem, but there is other methods, try using CJ and C0, meaning try using CFrame:Inverse with the object you wish to weld Next_Byte 21 — 6y
0
Frame:Inverse() doesn't seem to work... SnazzySpider67 53 — 6y
0
*CFrame SnazzySpider67 53 — 6y

Answer this question