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

My weld script makes the model fall and not stick??

Asked by
Galicate 106
4 years ago

Im using welds to weld a Prop Gun to your chest when you unequip/equip the gun.

So when you unequip the gun, it goes onto your chest, and when you equip it, it disapears. I've done this before and it has worked. But now, the model just falls to the ground as if the weld doesnt exist.

game.ReplicatedStorage.EquipWeaponEvent.OnServerEvent:Connect(function(Player, Setting, ToolType, ToolName, ToolModel)
    if Setting == "Unequip" then
        if ToolType == "Primary" then
            local Tool = game.ServerStorage[ToolName.."_Model"]:Clone()
            print("Cloned")
            Tool.Parent = Player.Character
            Tool:MoveTo(Player.Character.UpperTorso.Position)
            local Weld = Instance.new("Motor6D")
            Weld.Name = "PrimaryTool_Weld"
            Weld.Parent = Player.Character
            Weld.Part0 = Player.Character.UpperTorso
            Weld.Part1 = ToolModel.Handle
        end
    elseif Setting == "Equip" then
        if ToolType == "Primary" then
            Player.Character:FindFirstChild("PrimaryTool_Weld"):Destroy()
            Player.Character[ToolName.."_Model"]:Destroy()
        end
    end
end)

Any reason why or some advice on how to fix?

Answer this question